Skip to content

Commit

Permalink
Update intent-button.md
Browse files Browse the repository at this point in the history
use getInputProps for the input to avoid issues when setting defaultValue
  • Loading branch information
willhoney7 authored Aug 22, 2024
1 parent 55a8a4e commit d41b50b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/intent-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ 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, getInputProps } from '@conform-to/react';

export default function Tasks() {
const [form, fields] = useForm();
Expand All @@ -146,7 +146,7 @@ export default function Tasks() {
<ul>
{tasks.map((task, index) => (
<li key={task.key}>
<input name={task.name} />
<input {...getInputProps(task, { type: "text"})} />
<button
{...form.reorder.getButtonProps({
name: fields.tasks.name,
Expand Down

0 comments on commit d41b50b

Please sign in to comment.