-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use FormikStep inside a component within a FormikStepper #10
Comments
I'd just like to add that That's why the label is hard coded within it, and not passed as a prop into it. Thanks |
Hi export default function Threenumber() { return (
); export interface FormikStepProps export function FormikStep({ children }: FormikStepProps) { export function FormikStepper({ function isLastStep() { return ( {childrenArray.map((child, index) => ( index || completed} > {child.props.label} ))}
); |
Hi,
Thanks for the wonderful video and for providing all the code.
I am creating a site and would like to make FormikSteps within component so I can reuse them and make sure I keep the code DRY.
The problem I am having is when calling the component which returns a FormikStep inside a FormikStepper, the label and validationSchema don't exist on the parent, therefore the FormikStepper cannot access them.
Please see some example code:
MyForm.js
ReusableStep.js
When in the current state, the validation doesn't work, and the Material UI Step doesn't get a label.
The only way I can get it to work is by passing
validationSchema
andlabel
to theReusableStep
:This is not great, as I would have to repeat defining the schema each time I want to use the FormikStep.
Please could you help me get this sorted?
Many thanks,
Zac
The text was updated successfully, but these errors were encountered: