Put in order · Next.js course · Module 6: Forms and Server Actions

Zod Validation Steps in React Hook Form

Arrange the steps for integrating Zod with React Hook Form in the correct order

Items to put in order

  • Define schema: z.object({...})
  • Pass resolver: useForm({ resolver: zodResolver(schema) })
  • Display errors: errors.field.message
  • Generate type: z.infer<typeof schema>

You can check the correct answer by solving this task in the CodeWorlds game.