search

Home  >  Q&A  >  body text

javascript - How to get the value of form in rect-form

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? ? ?

PHPzPHPz2806 days ago727

reply all(2)I'll reply

  • 某草草

    某草草2017-05-19 10:45:11

    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.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-19 10:45:11

    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

    reply
    0
  • Cancelreply