How can I access data from Form outside react-final-form
See original GitHub issueSo, I would like to acess the data from Form outside him, for example, I have multiple forms in only a page:
<Form
validate={validate}
onSubmit={ (values, props) => props.reset() }
render={
({handleSubmit, invalid, ...props}) => {
return(
<form onSubmit={handleSubmit}>
...
</form>
)
}}
</Form>
<Form
validate={validate}
onSubmit={ (values, props) => props.reset() }
render={
({handleSubmit, invalid, ...props}) => {
return(
<form onSubmit={handleSubmit}>
...
</form>
)
}}
</Form>
//And I want check if all forms are valid, for example:
<button disable={ form1.invalid || form2.invalid }></button>
Someone have a idea about that?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:12
Top Results From Across the Web
Access react-final-form values from outside the form
The simplest way I found to get the form state outside the form is to use a MutableRefObject to get a reference to...
Read more >Final Form Docs – FAQ
If you define a variable outside of your form, you can then set the value of that variable to the handleSubmit function that...
Read more >React Final Form - Accessing other field values - CodeSandbox
React Final Form - Accessing other field values. Example to access the value of other react-final-form fields, to impact form behaviour.
Read more >How to use React Final Form to Manage Form State
In this tutorial, we will explore React form state management using React Final Form. React Final Form allows us to manage state without...
Read more >Top 5 react-final-form Code Examples - Snyk
Learn more about how to use react-final-form, based on react-final-form code examples created from the most popular ways it is used in public...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nice, I did it:
Work very well for me, thanks dude, cya
https://github.com/final-form/react-final-form/blob/92cd23e237b43d1dd8e5598381ab58ae8f97f9ed/src/ReactFinalForm.js#L58-L74