Stop Rebuilding UI

Shadcn.io is not affiliated with official shadcn/ui

React useMap Hook

React useMap hook for Map state with set, setAll, remove, and reset actions. Immutable updates, TypeScript generics. SSR safe.

Manage Map state in React with convenient CRUD helpers. useMap returns a Map instance plus set, setAll, remove, and reset actions. All updates create new Map instances for React's immutability requirements. Initialize with a Map or array of key-value tuples. Full TypeScript generics for key and value types. The returned Map has all read methods (get, has, keys, values, entries, forEach, size). Perfect for caching, lookup tables, form field tracking, or any keyed data. SSR safe—just a useState wrapper. Works with Next.js App Router and any React framework.

React useMap Hook preview

Scroll to load preview

Installation

FAQ

Was this page helpful?

Sign in to leave feedback.