Skip to content
Skills Library
Programming · Planning

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.

Licence
MIT
Last repository change
28.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.

Licence

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

  1. When to use
  2. Prerequisites
  3. Step-by-step workflow
  4. Commands / code examples
  5. Common mistakes & pitfalls
  6. Verification checklist
  7. Related skills
Original SKILL.md headings · 69 lines, 350 words
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

RepositoryScoreLicence
This page · nextboxis/library-skill-agents100MIT
rootcastleco/rei-skills100MIT
FrancoStino/opencode-skills-collection100MIT
davila7/claude-code-templates100MIT
sickn33/agentic-awesome-skills100MIT
aratkruglik/claude-sdlc100MIT
HoangNguyen0403/agent-skills-standard100MIT
wshobson/agents100MIT
rmyndharis/antigravity-skills100MIT

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.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.