/fuse-react:react-statefrom fuse-react
Implements Zustand v5 global state management for React with currying syntax, selectors, useShallow, and middleware composition. Covers domain-separated stores and SOLID file organization.
Ships in fuse-react. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers separating stores by domain (auth, cart, ui, theme) rather than one giant store, SOLID file organization (store.ts, store.interface.ts, use-store.ts), and forbidden patterns (persisting auth tokens, v4 syntax, skipping useShallow). This is the plain-React variant of Zustand (no App Router request-isolation concerns) — for Next.js App Router see nextjs-zustand, and for server state use TanStack Query instead of this skill.
Minimal, scalable state management with React 18+ useSyncExternalStore.
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
After implementation, run fuse-ai-pilot:sniper for validation.
| Feature | Benefit |
|---|---|
| Minimal API | Simple create() function, no boilerplate |
| React 18 native | useSyncExternalStore, no shims needed |
| TypeScript first | Full inference with currying pattern |
| Middleware stack | devtools, persist, immer composable |
| Bundle size | ~2KB gzipped, smallest state library |
| No providers | Direct store access, no Context wrapper |
create<State>()((set) => ({...}))modules/[feature]/src/stores/Stores organized by feature module:
modules/cores/stores/ - Shared stores (theme, ui)modules/auth/src/stores/ - Auth statemodules/cart/src/stores/ - Cart statemodules/[feature]/src/interfaces/ - Store types| File | Purpose |
|---|---|
store.ts | Store creation with create() (store budget 0.4 × FUSE_SOLID_MAX_LINES, 40 at default) |
store.interface.ts | TypeScript interfaces |
use-store.ts | Custom hook with selector |
Double parentheses required for TypeScript inference. Currying pattern ensures full type safety.
Stack middlewares: devtools -> persist -> immer. Order matters for TypeScript types.
Always use useStore((s) => s.field) for performance. Use useShallow for array/object selectors.
| Need | Reference |
|---|---|
| Initial setup | installation.md |
| Store patterns | store-patterns.md |
| Middleware | middleware.md |
| TypeScript | typescript.md |
| Slices pattern | slices.md |
| Auto selectors | auto-selectors.md |
| Reset state | reset-state.md |
| Subscribe API | subscribe-api.md |
| Testing | testing.md |
| Migration v4→v5 | migration-v5.md |
useStore((s) => s.field) for performance| Pattern | Reason | Alternative |
|---|---|---|
| Persisting auth tokens | Security vulnerability | httpOnly cookies |
| Without useShallow on objects | Excessive re-renders | useShallow(selector) |
| v4 syntax | TypeScript inference broken | v5 currying create<T>()() |
| Giant monolithic store | Hard to maintain | Slices or separate stores |
references/auto-selectors.md (opens in a new tab)references/installation.md (opens in a new tab)references/middleware.md (opens in a new tab)references/migration-v5.md (opens in a new tab)references/reset-state.md (opens in a new tab)references/slices.md (opens in a new tab)references/store-patterns.md (opens in a new tab)references/subscribe-api.md (opens in a new tab)references/testing.md (opens in a new tab)references/typescript.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
8 skills in this plugin
/react-19Use when implementing React 19.3 patterns — use(), useOptimistic, useActionState, useEffectEvent, Activity, ViewTransition, Fragment refs, use(browser()), React Compiler./react-formsUse when building type-safe forms in React with TanStack Form v1 — Zod/Yup/Valibot validation, async validation, field arrays./react-i18nUse when implementing translations in a React app (not Next.js) with react-i18next — useTranslation, namespaces, pluralization, Suspense.npx claudepluginhub fusengine/claude-plugins --plugin fuse-reactOther plugins' skills for the same job