#Use Form list with zod
9 messages Β· Page 1 of 1 (latest)
you can use any zod schema with useForm
zod is yelling at me when I try and do this
const schema = z.object({
transfers: {
email: z
.string()
.email({ message: "Invalid email" })
.min(1, { message: "Email is required" }),
}
});
because of the useFormList I have transfers
initialValues: {
transfers: formList([
{
email: "",
quantity: 0,
key: randomId(),
},
]),
},
basically the same question this person had #854810300876062773 message
I guess your schema maybe incorrect
zod is yelling at me
What is it yelling at you π ? And would you create a minimal codesandbox please.
maybe like
const schema = z.object({
transfers: z.array(z.object({
email: z
.string()
.email({ message: "Invalid email" })
.min(1, { message: "Email is required" }),
})),
});
π