Get value from html input in antd form

Viewed 708

I want to get value from custom HTML input in AntDesign, onFinish function of the form not getting the description value, I have attached the sample below.

<Form.Item
    label="description"
    name="description"
    rules={[
        {
            required: true,
            message: 'description is required',
        },
    ]}
>
    <CustomInput type="text" />
</Form.Item>
const CustomInput = () => {
   return <input type="text" />;
}

export default CustomInput;
1 Answers

In my case, I just need to pass custom component all props, because Form.Item pass to their onChange and value props

const CustomInput = ({ ...restProps }) => {
   return <input type="text" {...restProps} />;
}

export default CustomInput;
Related