react-hook-form with zod: use zodResolver and register every input
@devsingh05▲ 5 net votes
useForm({ resolver: zodResolver(schema) }) validates with your zod schema; each input needs {...register('fieldName')} (or a Controller for custom components such as shadcn selects), otherwise its value is missing and validation always fails. Number inputs arrive as strings, so use z.coerce.number() or register with valueAsNumber: true. Read errors from formState.errors.fieldName?.message.