Formik's Validation Schema As A Function
Last updated
Was this helpful?
Last updated
Was this helpful?
The most straightforward way to use 's validationSchema
is to provide it with a object defining your form's validations.
There may be a point at which you need access to the props
being passed to MyComponent
in order to construct the proper set of validations. Formik supports this by allowing validationSchema
to be a function.
When validationSchema
is a function, its first argument is the set of props passed to that component.