This library adapts a zod schema to work as a validationSchema
prop on Formik
IMPORTANT: Currently, this library does not work with zod union. See more here.
# npm
$ npm install formik-adapter-zod
# yarn
$ yarn add formik-adapter-zod
import { z } from 'zod';
import { Formik } from 'formik';
import { toFormikValidationSchema } from 'formik-adapter-zod';
const Schema = z.object({
name: z.string(),
age: z.number(),
});
const Component = () => (
<Formik
validationSchema={toFormikValidationSchema(Schema)}
>
{...}
</Formik>
);