useMap
Reactive Map collection state manager.
1.1 KB
•Updated on September 3, 2026
Installation
Bash
pnpm dlx shadcn@latest add @spaceui/hooks-form-use-mapUsage
Code
import { useMap } from '@/hooks/use-map'
const [map, actions] = useMap([['key', 'val']])
actions.set('key', 'newVal')API Reference
Parameters / Props
| Parameter | Type | Default | Description |
|---|---|---|---|
initialEntries | [K, V][] | [] | Initial pairs. |
Return Value
| Property | Type | Description |
|---|---|---|
map | Map<K, V> | Reactive Map instance. |
actions | Object | set, delete, clear, etc. |