Skip to content

Commit

Permalink
added a basic schema
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillSBarsukov committed Sep 28, 2024
1 parent 615dfb2 commit 1d47ca8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/intent-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,21 @@ To manipulate a field list, you can use the **insert**, **remove** and **reorder

```tsx
import { useForm } from '@conform-to/react';
import { parseWithZod } from "@conform-to/zod";
import { z } from "zod";

const todosSchema = z.object({
title: z.string(),
tasks: z.array(z.string()),
});

export default function Tasks() {
const [form, fields] = useForm();
const [form, fields] = useForm({
onValidate({ formData }) {
return parseWithZod(formData, { schema: todosSchema });
},
shouldValidate: "onBlur",
});
const tasks = fields.tasks.getFieldList();

return (
Expand Down

0 comments on commit 1d47ca8

Please sign in to comment.