Installation
Prerequisites
nanostores-storage requires nanostores as a peer dependency.
Install
bash npm install @vp-tw/nanostores-storage nanostores bash pnpm add @vp-tw/nanostores-storage nanostores bash yarn add @vp-tw/nanostores-storage nanostores bash bun add @vp-tw/nanostores-storage nanostores Framework Integrations
nanostores supports React, Vue, Svelte, Solid, Preact, Angular, and more. See nanostores integrations for setup instructions.
Example with React:
npm install @nanostores/reactTypeScript
nanostores-storage is written in TypeScript and includes type definitions. No additional @types packages needed.
Browser Support
nanostores-storage works in all modern browsers that support:
localStorage/sessionStorageStorageEventfor cross-tab synchronization
| Browser | Supported |
|---|---|
| Chrome 4+ | ✅ |
| Firefox 3.5+ | ✅ |
| Safari 4+ | ✅ |
| Edge 12+ | ✅ |
| IE 8+ | ✅ |
Bundle Size
nanostores-storage is designed to be lightweight:
| Export | Size (minified + gzip) |
|---|---|
createStorageStore | ~800 bytes |
createStorageValuesStore | ~900 bytes |
localStorageAdapter | ~400 bytes |
sessionStorageAdapter | ~400 bytes |
The library is fully tree-shakeable — only import what you use.
Next Steps
Continue to the Quick Start guide to create your first storage store.