javascript - How to get the value of form in rect-form
PHPz2017-05-19 10:43:11
0
2
673
I am using react-redux. The onSubmit method that comes with react-form can directly obtain form data through parameters. How can I obtain it through other methods? ? ?
Please analyze the code carefully. onSubmit is called there. It is obvious here that account is passed by reference. So, if you want to use it in other methods, you only need to pass it when calling.
react-form provides the getFormValues method, which can be called in mapDispatchToProps, so that the value of the form can be obtained, and then mapped to the props of the component, it can be passed as a parameter when calling. It’s a bit convoluted, but I haven’t found a better way yet
Please analyze the code carefully.
onSubmit is called there. It is obvious here that account is passed by reference.
So, if you want to use it in other methods, you only need to pass it when calling.
react-form provides the getFormValues method, which can be called in mapDispatchToProps, so that the value of the form can be obtained, and then mapped to the props of the component, it can be passed as a parameter when calling. It’s a bit convoluted, but I haven’t found a better way yet