# donavon/use-persisted-state

A custom React Hook that provides a multi-instance, multi-tab/browser shared and persistent state.

Repository: https://github.com/donavon/use-persisted-state
Canonical: https://ross.abutalabs.com/products/use-persisted-state
Language: JavaScript
License: MIT
License Family: permissive
Topics: react, reactjs, hooks, custom-hook, localstorage, persistence
Last push: 2023-04-26T18:53:55+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2764, "days_push": 1225, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1371, forks 93 (observed 2026-08-28T04:04:32.013151+00:00)

## What it is
A React hook factory that returns a drop-in replacement for useState, persisting state to localStorage. State is shared across multiple hook instances on a page and synced across browser tabs and windows.

## Use cases
- persist React state across page reloads
- sync state between browser tabs
- share state between multiple components using the same key
- remember user preferences like theme or counter values
- replace useState with a persistent version

## When to choose
- you need persistent client-side state without a backend
- you want cross-tab state synchronization in a React app
- you want a minimal drop-in replacement for useState

## When to avoid
- you need server-side persistence or shared state across users
- you are not using React 16.8+ with hooks
- you need to persist large amounts of data beyond localStorage limits

## Facets
- artifact type: library
- maturity: maintenance
- function: state-management, caching
- domain: frontend, web-development
- platform: browser
- tags: react-hooks, localstorage, persistence, cross-tab-sync, nodejs

## Member repositories
- donavon/use-persisted-state (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:32.013151+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:40:49.739238+00:00, confidence not recorded.
  - readme: https://github.com/donavon/use-persisted-state (fetched 2026-08-28T04:04:32.013151+00:00, sha 87cf8336b309)
  - registry_npm: https://registry.npmjs.org/use-persisted-state (fetched 2026-08-29T11:57:45.016730+00:00, sha fb5097927300)
- Data as of 2026-08-30T08:39:29.467469+00:00.
