Field Arrays
Invoice
Add, duplicate and remove line items. Row amounts and the total update as you type, and each one re-renders only when the values it watches change.
What this shows
useFieldArray manages the line items. Each row has a stable rowId, used as the React key and passed to the row's fields as ancestors. See Field Arrays.
append,insert,removeandgetFieldArrayValueadd, duplicate and remove rows.validateon the array requires at least one row.RowAmountwatches one row's fields withuseFieldWatch.Totalswatches two columns withuseFieldArrayColumnWatch. Each re-renders only when the values it reads change.