react-state-management
/react-state-management
Use this skill when architecting global or shared client state across React components using Context API, Zustand, or Redux Toolkit.
- Author
- nextboxis ↗
- Repository
- library-skill-agents ↗
- Licence
- MIT
- Last repository change
- 28.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when architecting global or shared client state across React components using Context API, Zustand, or Redux Toolkit.
Original author description
Use this skill when architecting global or shared client state across React components using Context API, Zustand, or Redux Toolkit.
How it works
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
SKILL.md preview
---
name: react-state-management
description: Use this skill when architecting global or shared client state across React components using Context API, Zustand, or Redux Toolkit.
---
# React State Management
## When to use
Use this skill when component prop drilling exceeds two levels, multiple unrelated components need synchronized state, or managing complex domain stores.
## Prerequisites
- Working knowledge of React hooks (`useState`, `useContext`, `useReducer`).
- Installed state library (e.g., `zustand` or `@reduxjs/toolkit`).
## Step-by-step workflow
1. **Classify state scope**: Distinguish local UI state (form inputs, modal toggles) from shared global state (user session, cart, cached records).
2. **Select the tool**: Use React Context for low-frequency changes (theming, locale); choose Zustand or Redux Toolkit for high-frequency data stores.
3. **Define store slices**: Define typed state interfaces and pure reducer/action functions.
4. **Implement selective subscription**: Use selector functions to subscribe components only to the specific slices of state they render.
5. **Persist and hydrate**: Add local storage synchronization middleware where offline persistence is required.
## Commands / code examples
```ts
// store/useCartStore.ts (Zustand example)
import { create } from 'zustand';
interface CartItem {
id: string;
name: string;
quantity: number;
}
interface CartState {
items: CartItem[];
addItem: (item: CartItem) => void;
removeItem: (id: string) => void;
}
export const useCartStore = create<CartState>((set) => ({
items: [],
addItem: (item) =>
set((state) => {
const existing = state.items.find((i) => i.id === item.id);
if (existing) {
return {
items: state.items.map((i) =>
i.id === item.id ? { ...i, quantity: i.quantity + item.quantity } : i
),
};
}
return { items: [...state.items, item] };
}),
removeItem: (id) =>
set((state) => ({ items: state.items.filter((i) => i.id !== id) })),
}));
```
## Common mistakes & pitfalls
- Storing server cache in global client state instead of dedicated query libraries (e.g., TanStack Query).
- Placing high-frequency updates into a single React Context, causing whole-tree re-renders.
- Mutating nested objects inside actions without producing new object references.
## Verification checklist
- [ ] Components use targeted selectors to prevent unnecessary re-renders.
- [ ] State updates are immutable and predictable.
- [ ] Server-derived data is clearly separated from client UI state.
- [ ] TypeScript interfaces cover state, actions, and selectors completely.
## Related skills
- react-fundamentals
- react-hooks-patterns
- typescript-advanced-type-system
- performance-code-review-complexity-allocations
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · nextboxis/library-skill-agents | 100 | MIT |
| rootcastleco/rei-skills | 100 | MIT |
| FrancoStino/opencode-skills-collection | 100 | MIT |
| davila7/claude-code-templates | 100 | MIT |
| sickn33/agentic-awesome-skills | 100 | MIT |
| aratkruglik/claude-sdlc | 100 | MIT |
| HoangNguyen0403/agent-skills-standard | 100 | MIT |
| wshobson/agents | 100 | MIT |
| rmyndharis/antigravity-skills | 100 | MIT |
Database snapshot: 13.11.2026 · package version 5bbffa96cffd (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100react-native-state-management
Implement local and global state with Context, Zustand, and Redux Toolkit in React Native. Use when choosing or implementing state management in React Native with Context, Zustand, or Redux. - 100state-management
Choose the smallest viable React/fullstack state owner before comparing libraries. Use when the user needs to classify local UI state, shared subtree/Context state, URL or form state, server-state caches, or client workflow stores such as Zustand / Redux Toolkit / Jotai.… - 95state-management-advisor
Choose and implement React state management solutions including Context, Zustand, Redux Toolkit, TanStack Query, and Jotai. Use when selecting state management, implementing global state, or managing server state in React applications. - 95state-management
Implement state management patterns for frontend applications. Use when managing global state, handling complex data flows, or coordinating state across components. Handles React Context, Redux, Zustand, Recoil, and state management best practices. - 95react-zustand-redux-toolkit
Use this skill when the user says 'Zustand store', 'Redux Toolkit', 'createSlice', 'RTK Query', 'configureStore', 'Zustand vs Redux', 'persist middleware', 'selector re-renders'. It implements React client state with Zustand or Redux Toolkit: typed stores, selectors that avoid… - 90react-state
Zustand v5 state management for React. Use when implementing global state, stores, persist, or client-side state.