Reputation: 1
I'm using Formik
to create form in my react app. There are few tabs on view, and all of them contain same form (form with same fields). I want some fields to be remembered while user switches tabs. What came to my mind is to save values into Redux
on field onChange
event but according to Formik
documentation it is not recommended to save Formik values
into Redux state
.
Also, on form submit, I want these values to be cleared/reset. What would be the best approcah?
Upvotes: 0
Views: 1936
Reputation: 15821
when switching tabs you can pass initialValues
to the new form.
initialValues
initialValues
The trick is do not store actual values but create at runtime an object to use as initialValues
Upvotes: 1