Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wshobson avatar

React State Management

  • 12k installs
  • 38.3k repo stars
  • Updated July 22, 2026
  • wshobson/agents

How to select, implement, and migrate between modern React state management solutions (Redux Toolkit, Zustand, Jotai, React Query, SWR) for different application scales and state types.

About

Comprehensive guide covering modern React state management patterns across local component state, global stores, and server state synchronization. Developers use this skill to architect state solutions for apps of any scale - from simple Zustand stores in small projects to complex Redux Toolkit + React Query setups in large applications. Key workflows include selecting the right tool by app complexity and state type, implementing optimistic updates, migrating legacy Redux codebases to Redux Toolkit using createSlice, and separating client state from server state concerns.

  • Covers 5 state categories: local, global, server, URL, and form state with tool recommendations
  • Zustand quick-start example with devtools middleware and persistence
  • Selection matrix: small apps use Zustand/Jotai; large apps use Redux Toolkit; server-heavy use React Query
  • Redux Toolkit migration guide showing legacy action/reducer pattern vs createSlice
  • Best practices emphasizing selector-based subscriptions, data normalization, and separation of concerns

React State Management by the numbers

  • 11,957 all-time installs (skills.sh)
  • +256 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #44 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

react-state-management capabilities & compatibility

Capabilities
state architecture selection by app size and com · zustand store creation with middleware · redux toolkit slice pattern implementation · react query server state management · migration from legacy redux patterns · selector based subscription optimization
Use cases
refactoring · api development · frontend
Platforms
macOS · Windows · Linux
Runs
Runs locally
Pricing
Free
npx skills add https://github.com/wshobson/agents --skill react-state-management

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs12k
repo stars38.3k
Security audit3 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorywshobson/agents

What it does

Choose and implement React state management (Redux Toolkit, Zustand, Jotai, React Query) for global, server, and local state.

Who is it for?

React applications needing global state, server state synchronization, or migration from legacy Redux patterns.

Skip if: Static sites, non-React frameworks, applications with no shared state needs.

When should I use this skill?

Setting up a new React project, choosing between state libraries, refactoring state architecture, or migrating legacy Redux.

What you get

Architect scalable, type-safe state management with correct tool selection, immutable updates, and separation of server vs client state concerns.

  • State architecture decision matrix
  • Implemented store with devtools and persistence
  • Migration plan from legacy Redux if applicable

By the numbers

  • 5 state categories: local, global, server, URL, form
  • 3 primary global state solutions highlighted: Redux Toolkit, Zustand, Jotai

Files

SKILL.mdMarkdownGitHub ↗

React State Management

Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization.

When to Use This Skill

  • Setting up global state management in a React app
  • Choosing between Redux Toolkit, Zustand, or Jotai
  • Managing server state with React Query or SWR
  • Implementing optimistic updates
  • Debugging state-related issues
  • Migrating from legacy Redux to modern patterns

Core Concepts

1. State Categories

TypeDescriptionSolutions
Local StateComponent-specific, UI stateuseState, useReducer
Global StateShared across componentsRedux Toolkit, Zustand, Jotai
Server StateRemote data, cachingReact Query, SWR, RTK Query
URL StateRoute parameters, searchReact Router, nuqs
Form StateInput values, validationReact Hook Form, Formik

2. Selection Criteria

Small app, simple state → Zustand or Jotai
Large app, complex state → Redux Toolkit
Heavy server interaction → React Query + light client state
Atomic/granular updates → Jotai

Quick Start

Zustand (Simplest)

// store/useStore.ts
import { create } from 'zustand'
import { devtools, persist } from 'zustand/middleware'

interface AppState {
  user: User | null
  theme: 'light' | 'dark'
  setUser: (user: User | null) => void
  toggleTheme: () => void
}

export const useStore = create<AppState>()(
  devtools(
    persist(
      (set) => ({
        user: null,
        theme: 'light',
        setUser: (user) => set({ user }),
        toggleTheme: () => set((state) => ({
          theme: state.theme === 'light' ? 'dark' : 'light'
        })),
      }),
      { name: 'app-storage' }
    )
  )
)

// Usage in component
function Header() {
  const { user, theme, toggleTheme } = useStore()
  return (
    <header className={theme}>
      {user?.name}
      <button onClick={toggleTheme}>Toggle Theme</button>
    </header>
  )
}

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

Do's

  • Colocate state - Keep state as close to where it's used as possible
  • Use selectors - Prevent unnecessary re-renders with selective subscriptions
  • Normalize data - Flatten nested structures for easier updates
  • Type everything - Full TypeScript coverage prevents runtime errors
  • Separate concerns - Server state (React Query) vs client state (Zustand)

Don'ts

  • Don't over-globalize - Not everything needs to be in global state
  • Don't duplicate server state - Let React Query manage it
  • Don't mutate directly - Always use immutable updates
  • Don't store derived data - Compute it instead
  • Don't mix paradigms - Pick one primary solution per category

Migration Guides

From Legacy Redux to RTK

// Before (legacy Redux)
const ADD_TODO = "ADD_TODO";
const addTodo = (text) => ({ type: ADD_TODO, payload: text });
function todosReducer(state = [], action) {
  switch (action.type) {
    case ADD_TODO:
      return [...state, { text: action.payload, completed: false }];
    default:
      return state;
  }
}

// After (Redux Toolkit)
const todosSlice = createSlice({
  name: "todos",
  initialState: [],
  reducers: {
    addTodo: (state, action: PayloadAction<string>) => {
      // Immer allows "mutations"
      state.push({ text: action.payload, completed: false });
    },
  },
});

Related skills

How it compares

Pick react-state-management over generic React skills when the stack is Redux Toolkit with typed hooks and slice patterns.

FAQ

When should I use Zustand vs Redux Toolkit?

Use Zustand for small apps with simple state. Use Redux Toolkit for large apps with complex state, time-travel debugging, and middleware needs.

Should server data go in Redux or React Query?

Use React Query to manage server state (caching, synchronization). Use Redux/Zustand only for client state. Avoid duplicating server state.

How do I avoid performance issues with global state?

Use selectors for granular subscriptions, colocate state near consumers, and keep derived data computed rather than stored.

Is React State Management safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Frontend Developmentfrontendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.