skip to Main Content

Reactjs – How to validate Zod Object depending on value of parent object

I have a zod schema like this: export const memberSchema = z .object({ name: z.string().min(3), lastname: z.string().min(3), nationality: zCountries, birthdate: z.date(), email: z.string().email(), tutor: z .object({ name: z.string(), lastname: z.string(), documentType: zDocumentationType, documentValue: z.string(), email: z.string().email(), phone: z.string().regex(/^d{9}$/) }) }).refine((data)…

VIEW QUESTION
Back To Top
Search