Click the button in the react parent component, and the child component passes data to it.

question:
the antd, used defines a model component and a form component. The form component is a child component of the model component. In the parent component app, use the component model, to get the form data of the child component when you want to click submit.
how can the form data obtained be passed when the submit button is clicked?
figure:

:

app.tsx


mode.tsx


form.tsx


DidMountsubmitProxy

Feb.28,2021

validateFields the second parameter can get all the attribute values of the form form
after getting the data, you can directly dispatch a effects .

gives you an example of login .

There are two ways of

for reference: 1: add refs to the form layer (child layer), and call validateFields and other methods in the submit event of the parent layer through refs to get the child layer instance. 2: add a state of checked to the model layer (parent layer), click the submit button every time, this.state.checked+1 , and then pass it to the form layer through props . The form layer listens on componentWillReceiveProps to listen for this.props.checked changes, triggers validateFields to get data, and then triggers this.props.submit.

call the validateFields method of the form component directly in the onClick event of model

this.props.form.validateFields((err,value) {
    // value 
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9d290-1934.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9d290-1934.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?