Nested fields
Manage nested arrays and object state with use-form hook
Source
Docs
Package
Properties paths
Most of form
handlers accept property path as the first argument.
Property path includes keys/indices of objects/arrays at which target property is contained:
Nested objects
Form values:
{ "terms": false, "user": { "firstName": "", "lastName": "" } }
Set nested object value
Nested object values validation
Nested arrays
Name
Status
Form values:
{ "employees": [ { "name": "", "active": false, "key": "asuikit-qe6grmfnt" } ] }
List handlers
useForm
hook provides the following handlers to manage list state:
removeListItem
– removes list item at given indexinsertListItem
– inserts list item at given index (appends item to the end of the list if index is not specified)reorderListItem
– reorders list item with given position at specified field