Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions.
.claude/skills/wshobson-react-state-management/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 41% | 0% |
| case-01 | ✓→✗ | ▼ Worse | 20% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 33% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 72% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 20% | 0% |
Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization.
| Type | Description | Solutions | | ---------------- | ---------------------------- | ----------------------------- | | Local State | Component-specific, UI state | useState, useReducer | | Global State | Shared across components | Redux Toolkit, Zustand, Jotai | | Server State | Remote data, caching | React Query, SWR, RTK Query | | URL State | Route parameters, search | React Router, nuqs | | Form State | Input values, validation | React Hook Form, Formik |
Small app, simple state → Zustand or Jotai
Large app, complex state → Redux Toolkit
Heavy server interaction → React Query + light client state
Atomic/granular updates → Jotaitypescript// 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 pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
typescript// 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 }); }, }, });
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→fail | 10,668 | 6,015 | -44% | 1 | 1 | 0% | 1,889 | 2,264 | +20% | 0 | 0 | — |
case-02 | pass→pass | 17,805 | 15,039 | -16% | 1 | 1 | 0% | 3,038 | 4,047 | +33% | 0 | 0 | — |
case-03 | pass→pass | 6,945 | 6,579 | -5% | 1 | 1 | 0% | 1,358 | 2,332 | +72% | 0 | 0 | — |
case-04 | pass→pass | 14,200 | 11,939 | -16% | 1 | 1 | 0% | 2,727 | 3,274 | +20% | 0 | 0 | — |
case-05 | fail→pass | 9,360 | 7,549 | -19% | 1 | 1 | 0% | 1,683 | 2,376 | +41% | 0 | 0 | — |
case-06 | pass→pass | 11,923 | 14,111 | +18% | 1 | 1 | 0% | 2,164 | 3,320 | +53% | 0 | 0 | — |
case-07 | pass→pass | 8,041 | 6,547 | -19% | 1 | 1 | 0% | 1,635 | 2,357 | +44% | 0 | 0 | — |
case-08 | pass→pass | 11,376 | 11,450 | +1% | 1 | 1 | 0% | 2,675 | 3,585 | +34% | 0 | 0 | — |
case-09 | pass→pass | 10,930 | 8,811 | -19% | 1 | 1 | 0% | 2,172 | 2,964 | +36% | 0 | 0 | — |
case-10 | pass→pass | 8,835 | 4,159 | -53% | 1 | 1 | 0% | 1,584 | 1,708 | +8% | 0 | 0 | — |
case-11 | pass→pass | 12,801 | 12,579 | -2% | 1 | 1 | 0% | 2,376 | 3,544 | +49% | 0 | 0 | — |
case-12 | pass→pass | 11,120 | 8,569 | -23% | 1 | 1 | 0% | 1,789 | 2,569 | +44% | 0 | 0 | — |
case-13 | pass→pass | 5,832 | 4,970 | -15% | 1 | 1 | 0% | 1,110 | 1,943 | +75% | 0 | 0 | — |
case-14 | pass→pass | 12,523 | 12,031 | -4% | 1 | 1 | 0% | 2,452 | 3,300 | +35% | 0 | 0 | — |
case-15 | pass→pass | 11,402 | 8,722 | -24% | 1 | 1 | 0% | 2,277 | 2,646 | +16% | 0 | 0 | — |
case-16 | pass→pass | 9,078 | 7,074 | -22% | 1 | 1 | 0% | 1,925 | 2,335 | +21% | 0 | 0 | — |
case-17 | pass→pass | 7,292 | 6,384 | -12% | 1 | 1 | 0% | 1,375 | 2,270 | +65% | 0 | 0 | — |
case-18 | pass→pass | 4,375 | 6,018 | +38% | 1 | 1 | 0% | 818 | 2,153 | +163% | 0 | 0 | — |
case-19 | pass→pass | 12,302 | 9,563 | -22% | 1 | 1 | 0% | 2,191 | 3,157 | +44% | 0 | 0 | — |
case-20 | fail→fail | 12,664 | 11,733 | -7% | 1 | 1 | 0% | 2,608 | 3,533 | +35% | 0 | 0 | — |
case-21 | pass→pass | 8,262 | 8,122 | -2% | 1 | 1 | 0% | 1,695 | 2,573 | +52% | 0 | 0 | — |
case-22 | pass→pass | 13,559 | 8,476 | -37% | 1 | 1 | 0% | 2,289 | 2,492 | +9% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of 0 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.