From fd6e5b003ade0b365a7f351a3b1584cb0554a714 Mon Sep 17 00:00:00 2001 From: Kirill Barsukov Date: Thu, 12 Sep 2024 15:21:54 -0400 Subject: [PATCH 1/9] Updated a code-snippet of insert, remove, and reorder. --- docs/intent-button.md | 53 +++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/docs/intent-button.md b/docs/intent-button.md index 417ea316..85aadaa3 100644 --- a/docs/intent-button.md +++ b/docs/intent-button.md @@ -135,37 +135,42 @@ Be aware that both intents requires setting up the inputs with the **key** from To manipulate a field list, you can use the **insert**, **remove** and **reorder** intents. ```tsx -import { useForm } from '@conform-to/react'; +import { useForm, getFormProps, getInputProps } from '@conform-to/react'; export default function Tasks() { const [form, fields] = useForm(); const tasks = fields.tasks.getFieldList(); return ( -
+ - - - - ) - })} + {tasks.map((task, index) => ( +
  • + + + +
  • + ))} - - - ))} + {tasks.map((task, index) => { + const taskFields = task.getFieldset(); + return ( +
  • +
    + + + +
    +
  • + ) + })} - - - - ) - })} + {tasks.map((task, index) => ( +
  • + + + +
  • + ))}