What problem does it solve?
Managing shared UI and application state across components can be error-prone, lead to unnecessary re-renders, and force ad-hoc subscription and cleanup logic; this Skill provides a predictable, immutable reactive store abstraction to simplify state flow and derived computations.
Core Features & Use Cases
- Store: Lightweight immutable state container with setState, prevState, and listener subscriptions for single-source-of-truth state.
- Derived (Computed): Compose computed values from multiple stores with mountable lifecycle and previous-value awareness for accumulators and chaining (filter -> sort -> paginate).
- Effect & Batch: Side-effect management tied to dependencies and batching of multiple updates into a single notification to avoid redundant renders.
- Use Case: Use a module-level counter store shared across components, derive a doubled value, log changes via an Effect, and subscribe in React with the React adapter to minimize re-renders.
Quick Start
Install @tanstack/store and @tanstack/react-store, create a Store with your initial state, mount any Derived or Effect instances as needed, and use the React useStore hook with a selector to read and update state from components.