tanstack-store

Create immutable reactive stores with derived values and batched updates.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/TaherMustansir1929/zainy-water-v3 --skill tanstack-store-tahermustansir1929
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-store
Source: https://github.com/TaherMustansir1929/zainy-water-v3/tree/main/.agents/skills/tanstack-store
Command: npx skills add https://github.com/TaherMustansir1929/zainy-water-v3 --skill tanstack-store-tahermustansir1929

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about tanstack-store

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage shared UI state across components without causing unnecessary re-renders in React?

To manage shared UI state without unnecessary re-renders, use an immutable reactive store with selector-based subscriptions and shallow equality checks. This approach batches multiple updates into a single notification, ensuring components only re-render when their selected state slice actually changes.

What is the best way to compute derived state from multiple stores in a front-end application?

The best way to compute derived state is using a Derived computed value that composes data from multiple stores. This method supports mountable lifecycle and previous-value awareness, allowing you to chain operations like filtering, sorting, and pagination predictably.

How do I handle side effects and batch state updates in a reactive store?

You can handle side effects and batch state updates by using Effect and batch operations. Effects manage side-effect logic tied to store dependencies, while batching groups multiple state updates into a single notification to avoid redundant renders.

Does this reactive store work with front-end frameworks other than React?

Yes, this reactive store works with front-end frameworks including React, Vue, Solid, Angular, and Svelte. It provides a core immutable state container and offers a specific React adapter with a useStore hook for seamless integration.

When should I use an immutable reactive store instead of component-level state?

Use an immutable reactive store instead of component-level state when managing shared application state across multiple components. It solves subscription cleanup issues and provides a single source of truth, whereas component state is better for localized, isolated data.