Using react-hook-form in multistep without using a state manager

Viewed 775

I've started to use react-hook-form couple of weeks ago on a project. I've got a requirement where a large form needs to be spread out into a stepper (using @mui). I have looked at the sample provided at https://react-hook-form.com/advanced-usage under Wizard Form / Funnel. The example shows how to save form values to the state manager on form submit. But I want to save it to the state manager when user goes back to previous step as well so that they don't lose already entered data in the current step.

So I came up with a solution that I have tried to show in this codesandbox. it uses Yup validation when hitting Next and Save in final step.

Any reason why I shouldn't implement multistep form the way I have done it without using a state manager?

0 Answers
Related