Open
Description
I am a fan of ant-design.As the usage scenarios in business projects gradually increase, I find the getFieldValue
function are not quite smart.The getFieldValue
function will return undefined when render component, even though we set an initialValue
props in a FormItem component.
I don't know why it's set like this,is there a reason this case?
Code example:
const App = () => {
const [form] = Form.useForm();
const name = form.getFieldValue("name");
console.log(name); // undefined
return (
<Form {...layout} form={form} name="control-hooks">
<Form.Item
name="name"
label="Name"
initialValue="test"
rules={[{ required: true }]}
>
<Input />
</Form.Item>
</Form>
);
};
Metadata
Metadata
Assignees
Labels
No labels