react-state-management

Implement React state management with Redux Toolkit, Zustand, Jotai, and React Query.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill react-state-management-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-state-management
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/react-state-management
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill react-state-management-sanketadlak

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 patterns and selection criteria so you can set up stores, server-state caching, and optimistic updates without trial and error. ## 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 type. - Ready-to-Use Patterns: TypeScript implementations for Redux slices with async thunks, Zustand slice composition, Jotai atoms, and React Query hooks with optimistic updates. - Migration Support: Step-by-step conversion from legacy Redux boilerplate to modern Redux Toolkit with createSlice. - Use Case: When building a dashboard that needs both UI state (sidebar, modals) and server data (users, stats), use this Skill to combine Zustand for client state with React Query for cached server data. ## Quick Start Ask the AI to set up a Zustand store with TypeScript for user authentication state in your React app.

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 for atomic granular updates. For heavy server interaction, pair React Query with a light client state solution.

How do I implement optimistic updates with React Query?

Use the useMutation onMutate callback to cancel outgoing queries, snapshot the previous cache value, and set the new data optimistically. On error, roll back using the snapshot, and invalidate the query key onSettled to refetch.

Should I use React Query or Redux for server state?

Use React Query for server state since it handles caching, refetching, and staleness automatically. Reserve Redux Toolkit or Zustand for client state like UI toggles and modals, avoiding duplication of server data in global stores.

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. Use createAsyncThunk for async logic instead of manual thunk middleware.