-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
I'm building a multi step form and on each step I need to validate different fields. The problema I'm finding is that I have to wrap te steps outside the Wizard component and I need to load formik inside the Wizard component to have access to the activeStep, like
<Wizard>
<Formik
initialValues={{
firstName: '',
lastName: '',
email: '',
password: '',
username: '',
phoneNumber: '',
}}
validationSchema={SignUpValidations[activeStep]} # I know it'I have not used useWizard to get this value, I can wrap that later, but you get the ide.
onSubmit={handleOnSubmit}
>
{() => (
<>
<StepOne />
<StepTwo />
</>
)}
</Formik>
</Wizard>
with formik I used to do:
const stepsValidations = [
StepOneSchema,
StepTwoSchema,
]
<Formik
validationSchema={stepsValidations[steps]}
....
``
any solution to this?
ChenReuven, groomain and algooru
Metadata
Metadata
Assignees
Labels
No labels