Ant Design provides a powerful and easy-to-use form system with a lot of components for developer to use, and it’s also easy for developers to create a custom component to be used as a form items.
To do so, you’ll need to understand how Ant Design’s Form.Item component handles value of its child component:
Form.Item sets a prop called value to its child component.
Form.Item reads its child components value from a callback prop called onChange.
/** * A demo that changes it's number value on click. * @param value initialValue passed by parent Form.Item. * @param onChange a callback for Form.Item to read its child component's value. * @constructor */ const CustomFormItem: React.FC<CustomFormItemProps> = ({value, onChange}) => {