Nano Stores is a state management library designed for small, fast, and easily tree-shakeable applications. It focuses on moving application logic into stores, making the codebase more modular and testable. It supports multiple frameworks (React, Preact, Vue, Svelte, Solid, Lit, Angular, and vanilla JS).
Nano Stores Persistent (for local storage synchronization): This library extends Nano Stores to manage state persistently in localStorage
and synchronize changes across browser tabs.
Core Concepts:
- Atoms: Basic store for primitive types (e.g., numbers, strings, arrays, objects).
- Maps: Stores key-value pairs. Changes to keys are tracked and can be used to trigger updates. Handles updating (like
setKey()
) instead of complete replacement.