ant-design/components/form/demo/dep-debug.md
07akioni 27b6ba6947
feat: form item dep (#25408)
* feat: warnings

* feat: deps work on FormItem with render props

* chore: add details warning info

* chore

* chore: rerun ci

* chore: revert

* docs

* docs
2020-07-03 16:25:29 +08:00

795 B

order title
99
zh-CN en-US
Dep Debug Dep Debug

zh-CN

Buggy!

en-US

Buggy!

import { Form, Input } from 'antd';

let acc = 0;

const Demo = () => {
  const [form] = Form.useForm();
  return (
    <Form
      form={form}
      name="debug"
      initialValues={{
        debug1: 'debug1',
        debug2: 'debug2',
      }}
    >
      <Form.Item noStyle dependencies={['debug1']}>
        {() => {
          return acc++;
          // return <pre>{JSON.stringify(form.getFieldsValue(), null, 2)}</pre>;
        }}
      </Form.Item>
      <Form.Item label="debug1" name="debug1">
        <Input />
      </Form.Item>
      <Form.Item label="debug2" name="debug2">
        <Input />
      </Form.Item>
    </Form>
  );
};

ReactDOM.render(<Demo />, mountNode);