useMap
Custom hook that manages a key-value [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) state with setter actions.
Custom hook that manages a key-value Map state with setter actions.
Usage
import { useMap } from "@tilt-legal/cubitt-components/utilities/hooks";
const [map, mapActions] = useMap();
// Access the `map` state and use `mapActions` to set, remove, or reset entries.API
Signature
declare function useMap<K, V>(initialState?: MapOrEntries<K, V>): UseMapReturn<K, V>;Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
[initialState] | MapOrEntries<K, V> | The initial state of the map as a Map or an array of key-value pairs (optional). | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | UseMapReturn<K, V> | A tuple containing the map state and actions to interact with the map. |