useListData
Manages state for an immutable list data structure, and provides convenience methods to update the data over time.
We use the useListData
hook from react-spectrum stately package
.
The hook helps manage an immutable list data structure, with helper methods to update the data in an efficient way. Since the data is stored in React state, calling these methods to update the data automatically causes the component to re-render accordingly.
More information can be found in the react-spectrum documentation.
Usage
Import
To import the hook you just have to use this code below.
import { useListData } from '@marigold/components';
Examples
Table with input field
This example show how to update data inside a table.
Preview
Code
Name | Firstname | House | Year of birth |
---|---|---|---|
Potter | Harry | 1980 | |
Malfoy | Draco | 1980 | |
Diggory | Cedric | 1977 | |
Lovegood | Luna | 1981 |