react-state-management

Implements React state management patterns using Redux Toolkit, Zustand, Jotai, and React Query.

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/Eng-suso/BK-GPT --skill react-state-management-eng-suso
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-state-management
Source: https://github.com/Eng-suso/BK-GPT/tree/main/.claude/skills/react-state-management
Command: npx skills add https://github.com/Eng-suso/BK-GPT --skill react-state-management-eng-suso

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing and implementing the right state management approach in React is confusing, with overlapping options for local, global, server, URL, and form state. This Skill provides concrete, production-style patterns for each category so you avoid over-globalizing state, duplicating server data, and causing unnecessary re-renders. ## Core Features & Use Cases - Library Selection Guidance: Decision criteria for choosing between Redux Toolkit, Zustand, Jotai, and React Query based on app size and state complexity. - Typed Implementation Patterns: Ready-to-adapt TypeScript examples including RTK slices with async thunks, Zustand slice composition with selective subscriptions, Jotai atoms with derived and async state, and React Query hooks with optimistic updates. - Migration Support: Step-by-step conversion from legacy Redux boilerplate to modern Redux Toolkit with createSlice and Immer. - Use Case: When building a dashboard that mixes UI state (sidebar, modals) with server data (users, stats), apply the combined pattern using Zustand for client state and React Query for cached server state. ## Quick Start Ask the AI to set up a typed Zustand store with user authentication state and a React Query hook with optimistic updates for your React project.

Frequently Asked Questions about react-state-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Redux Toolkit, Zustand, and Jotai?▼

Choose Zustand or Jotai for small apps with simple state, Redux Toolkit for large apps with complex state, and Jotai when you need atomic granular updates. For heavy server interaction, pair React Query with a light client state library.

How do I implement optimistic updates with React Query?▼

Use the onMutate callback to cancel outgoing queries, snapshot the previous data, and set the new value with setQueryData. On error, roll back using the snapshot, and on settle, invalidate the query key to refetch fresh data.

Should I use React Query or Redux for server state?▼

Use React Query for server state since it handles caching, staleness, and refetching automatically. Reserve Redux Toolkit or Zustand for client-only state like UI preferences, modals, and form drafts to avoid duplicating server data.

How do I prevent unnecessary re-renders with Zustand?▼

Use selective subscriptions by passing a selector function to the store hook, such as useStore((state) => state.user). Components then only re-render when their selected slice changes rather than on any store update.

How do I migrate from legacy Redux to Redux Toolkit?▼

Replace action type constants and switch statements with createSlice, which generates actions automatically and allows mutable-style updates via Immer. Combine slices with configureStore and add typed useAppDispatch and useAppSelector hooks for TypeScript.

When should state stay local instead of going into a global store?▼

Keep state local with useState or useReducer when it is only used by one component or its children. Global stores should hold state shared across distant components; over-globalizing adds complexity and causes avoidable re-renders.