astoilkov/use-local-storage-state
React hook that persists data in localStorage observed · 2026-08-28
Health v2 · maintenance only
90/100
- Activity 92
- Release rhythm 81
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 34
- age_days: 2365
- days_rel: 48
- days_push: 48
- n_releases_24m: 4
Adoption not part of the score
1231 stars · 43 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A React hook that persists component state in localStorage, acting as a drop-in replacement for useState. It supports SSR, cross-tab synchronization via the storage event, and an in-memory fallback when localStorage is unavailable.
Use cases
- persist react state across page reloads
- sync state between browser tabs
- replace useState with localStorage-backed state
- store todos or user preferences in localStorage
- handle localStorage unavailability gracefully in react apps
- ssr-safe localStorage state in next.js
When to choose
- you need a tiny, production-ready React hook for persistent state
- you want cross-tab/window state synchronization
- you need SSR compatibility and React 18/19 concurrent rendering support
When to avoid
- you need persistence beyond the browser (server-side or native)
- you need to store large or complex data structures
- your project is not React-based
Facets
library · maturity stable
state-management ui-components frontend web-development browser react-hook localstorage persistence ssr cross-tab-sync nodejs
2 sources
- readme: https://github.com/astoilkov/use-local-storage-state · fetched 2026-08-28 · 5fced20f448d
- registry_npm: https://registry.npmjs.org/use-local-storage-state · fetched 2026-08-29 · 87c97a22b2a1
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| astoilkov/use-local-storage-state | main | 90 |
For agents
markdown · JSON · MCP: product_card(name="astoilkov/use-local-storage-state")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem