Custom React hook (v2.0.5) for state management like `useState` but persisted to `localStorage`. Supports `sessionStorage`, custom serializers, and real-time synchronization across tabs via storage events. Requires React 18 or 19. Ships TypeScript types. More lightweight than alternatives like `react-storage-hooks` or `use-persisted-state`, with a focus on simple hook-based API and external get/set/subscribe utilities.
npm install use-storage-backed-stateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal example of using `useStorageBackedState` with `localStorage` persistence.
Update calls to use object argument: `useStorageBackedState({ key: 'myKey', defaultValue: 0 })`.Replace `initialValue` with `defaultValue`.
No fix needed; expected behavior.
Use `storage: null` to opt out of storage.
Use `defaultValue` instead.
useStorageBackedState({ key: 'myKey', defaultValue: 0 })Replace `initialValue` with `defaultValue`.
npm install use-storage-backed-state