Formik as a controlled component
See original GitHub issueIt would be nice to be able to use Formik as a controlled component, perhaps as an ‘advanced’ API. This will allow more control over the forms state and allow triggers for submitting the form outside of Formik’s render.
For this to be possible it would probably be necessary to also expose any validation tools used internally when handleSubmit
is called.
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Field
as can either be a React component or the name of an HTML element to render. Formik will automagically inject onChange , onBlur...
Read more >Controlled vs Uncontrolled Components in React - Pieces.app
Formik is a complete solution that helps you to implement form validation, keep track of visited fields, and handle form submission in an ......
Read more >formik warning, A component is changing an uncontrolled ...
Warning: A component is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to ...
Read more >A guide to React forms and events using Formik
The Field component in Formik is used to automatically set up React forms with Formik. It's able to get the value by using...
Read more >How to Use Formik to Create Forms in React
You can create React forms using either controlled components or uncontrolled components. A controlled component is one whose form data is ...
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 FreeTop 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
Top GitHub Comments
Just use vanilla React if you need more control
Perhaps this could have a little more discussion around it, even if just to give future people reading an understanding of why or why not the decision was made.
IMO this would add significant value to the library with minimal code changes required - which I say with little knowledge of the architecture of the library so the latter may not be true.
What are your objections to using
<Formik />
as a controlled component?