SSE Hooks

useMap

Custom hook that manages a key-value Map state with setter actions.

Installation

npx sse-hooks add use-map

Usage

example.ts
import { useMap } from "./{hooks file}";

const [map, mapActions] = useMap();
// Access the `map` state and use `mapActions` to set, remove, or reset entries.

API

Parameters

Prop Default Type
initialState

...

Map<K, V> | [K, V][]

The initial state of the map as a Map or an array of key-value pairs (optional).

Returns

Return Value Default Type
return-

[Omit<Map<K, V>, "set" | "clear" | "delete">, UseMapActions<K, V>]

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026