Reputation: 1
I'm building a multistep form where I have 3 steps:
I'm having trouble to make the architecture for such form where I don't know what fields to expect on the second step and how to type it? I used zod schema for first step but then I realized it's not suitable for me because I don't know what fields to expect and I can't change validation schema on the fly (?)
I was thinking about having 3 separate forms for each step and manage their own state like react-hook-form does in wizard form https://react-hook-form.com/advanced-usage#WizardFormFunnel. But this solution feels odd for my case, I don't have separate routes for each step if user reloads the page, they will loose the data and will go to step 1 and it's expected
I have several questions:
const { register, control, } = useForm<Inputs>({ defaultValues: PAYMENT_DEFAULT_VALUES, });
Upvotes: 0
Views: 153