UseControlledList
Last Updated: 2.0.0 (22/01/2024)
Usage
import { useControlledList, Button, Text } from "@valence-ui/core";
function MyComponent() {
const controlledList = useControlledList<string>(["hello", "world"]);
return (
<>
{controlledList.items.map((item, index) => (
<Text
key={index}
>
{item}
</Text>
))}
<Button
onClick={() => controlledList.add("there")}
>
Add "there"
</Button>
<Button
onClick={() => controlledList.remove("world")}
>
Remove "world"
</Button>
<Button
onClick={() => controlledList.clear()}
>
Clear
</Button>
</>
)
}Return type
Attribute
Type
Description
Last updated