(props: FieldArrayProps) => (value: any, helpers: FieldArrayHelpers<any>) => ReactNode
A component version of useFieldArray.
Example
FieldArrayProps
string
The name of the "field". If you're using array syntax, then this is the base name of the field (not include array index specifier).
Example: If you're items named todos[0], todos[1], etc, then the name would be todos.
stringOptional
Allows you to use the component outside a form.
FieldArrayHelpers
Many of these helpers parallel native array helpers, but please note that, unlike the native array methods, none of these helpers return anything.
(item: Item) => void
Adds a new item to the end of the array.
(indexA: number, indexB: number) => void
Swaps the items at the given indices.
(from: number, to: number) => void
Moves the item at the from index to the to index.
(index: number, item: Item) => void
Inserts an item at the given index.
() => void
Removes the item at the start of the array.
() => void
Removes the item at the end of the array.
(index: number) => void
Removes the item at the given index.
(index: number, item: Item) => void
Replaces the item at the given index.