From harness-claude
Guides choosing the right React state management approach: local state, Context, Zustand, Redux Toolkit, or React Query/SWR. Decision tree for app scale and state type.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:react-state-management-patternThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Choose the right state management approach for your React application scale
Choose the right state management approach for your React application scale
Decision tree:
useState / useReducer. Do not reach for global state until you have a specific problem.useContext for data that rarely changes (theme, auth, locale).// Zustand: minimal setup
import { create } from 'zustand';
interface BearStore {
count: number;
increment: () => void;
}
const useBearStore = create<BearStore>((set) => ({
count: 0,
increment: () => set((s) => ({ count: s.count + 1 })),
}));
State categories:
Library comparison (2024):
| Library | Bundle | Boilerplate | DevTools | Selectors |
|---|---|---|---|---|
| Context | 0KB | Low | No | No |
| Zustand | ~1KB | Very low | Yes | Yes |
| Jotai | ~3KB | Low | Yes | Atoms |
| Redux Toolkit | ~12KB | Medium | Excellent | Yes |
React 19 note: With the React compiler, many manual performance optimizations in Zustand/Redux become less necessary as React auto-memoizes.
https://patterns.dev/react/state-management
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeGuides React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between solutions.
Implements React state management patterns with Redux Toolkit, Zustand, Jotai, React Query for global state, server state, optimistic updates, and library selection.
Guides frontend state management in React: local/global decisions, Zustand/Redux Toolkit/Jotai/MobX/Context, TanStack Query/SWR for server state, optimistic updates, XState machines. Use for store setup, migrations, re-render fixes.