I've created a form using Ant design's Form.create() and i want to access it's field's values in another component. Using redux, i can do that using:
function mapStateToProps(state) {
return {
formStates: getFormValues('form')(state),
};
}
is there a way to do that for Ant design's Forms?
valuePropName is the name of the prop of the child component that will contain the value. In most cases, components such as Input or Select use value as the prop for holding the value. However, certain components such as Checkbox or Switch use checked .
You have to click the "+ Add Field" button for the dynamic form to add and show the first field as shown here..
antd is 348kB uncompressed. The entire app including antd, React and stupidly large lodash plus lots of other stuff is 350kB gzipped.
It can get the field values if the other component is inside Form.create()
.
Once the field has been registered with getFieldDecorator
, you can access the value by props.form.getFieldValue('fieldName')
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With