UseControlledList
Last Updated: 2.0.0 (22/01/2024)
useControlledList
allows lists of a particular type to be controlled through a unified API.
The type modifier passed in with the hook determines what type of items the hook will control. By default, this is string
.
Usage
Return type
Attribute
Type
Description
items
T[]
The list of items.
add
(item: T) => void
Add an item to the list.
remove
(item: T) => void
Remove an item from the list.
update
(items: T[]) => void
Override all items in the list.
clear
() => void
Clear the list.
includes
(item: T) => boolean
Whether the list includes an item.
Last updated
Was this helpful?