Auto-saving forms
See original GitHub issueHi @jaredpalmer! I was looking to migrate my forms to a simpler library and wondering if the Formik’s API would support auto-saving forms. I went through the README, but wasn’t sure if it would be possible (Apologies if I missed something!)
Usecase:
Creating an auto-saving form, where values are saved as the user enters them. This, in most cases, will imply that the changes are saved (and/or validated server-side) onChange
, though probably debounced. In some cases, onBlur
can work but it is not always the optimum user-experience (for example, choosing a username).
Users might choose to submit in one of two manners - submit the entire form, or submit just that field. This is likely to happen when it is a heavier or a longer form.
So, the two features needed would be -
- Submit on change or blur.
- Submit that individual field rather than the entire form.
Thank you!
PS. FWIW, I hacked together a solution currently using Redux-Form and React-Debounce-Input that can be found here - http://gist.github.com/oyeanuj/2f69ebe1004e2ff47d7550d957bf05cf with the basic overview in the file TheAutoSavingForm.md
in that gist.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:15 (4 by maintainers)
Top GitHub Comments
The goal of my example to show the pattern you might use to handle pretty much kind of extended Formik behavior. Much like React Router 4, Formik is just a React component. This means that the problems you run into can usually be solved with just React and don’t require expanding the API. That being said, if there is a community need, I’d probably codify and bless a solution by creating formik-autosave
Seeing as how in 2019 this is now how the majority of mobile forms work my opinion is that this should be a mainline option presented by the plugin itself. I know that this plugin isn’t explicitly for react-native but not having this feature somewhat excludes react native from working well with this plugin. Just my two cents here. I wouldn’t mind adding a PR to
react-native-formik
to address the lack of this feature.