useFieldArray is a hook help managing array in the form.
It produce wrappers around setFieldValue to reduce boilerplate when managing arrays.
const { append, prepend, insert, swap, move, update, replace, remove } =
useFieldArray({ formControl, name });
formControl is a result of calling parent's form useFormname is a path to any array in the parent's valueuseFieldArray returns an object with array helpers.
append: (element: ArrType) => void; adds array element to the end of the arrayprepend: (element: ArrType) => void; insert array element to the start of the array (at index 0)insert: (index: number, element: ArrType) => void; insert array element to the specified indexswap: (from: number, to: number) => void; swaps array elements at the provided indexesmove: (from: number, to: number) => void; move element at index from to index toupdate: (index: number, element: ArrType) => void; change element at indexreplace: (elemets: ArrType[]) => void; overwrite array with new elementsremove: (...index: number[]) => void; remove one or several elements on the specified indexes