state-management

Coordinate server state with React Query and local UI state with Zustand.

62|9|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/AsyrafHussin/agent-skills --skill state-management-asyrafhussin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-management
Source: https://github.com/AsyrafHussin/agent-skills/tree/main/skills/state-management
Command: npx skills add https://github.com/AsyrafHussin/agent-skills --skill state-management-asyrafhussin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

State management in React apps often becomes a bottleneck, requiring clean patterns for server state (React Query) and client state (Zustand) to avoid prop drilling and data staleness.

Core Features & Use Cases

  • Patterns for server state: query keys, caching, mutations, invalidation, and optimistic updates.
  • Client state with Zustand: stores, persistence, selectors, and devtools.
  • Real-world use: combining server and client state for complex dashboards and collaborative apps.

Quick Start

Install and configure a React Query server-state layer alongside a Zustand client-state store to orchestrate data flow across components.

Frequently Asked Questions about state-management

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

FAQPage Schema
What is the best way to manage server state and client state in React?

The best way to manage server and client state in React is separating server state with React Query and local UI state with Zustand. This pattern reduces prop drilling and prevents data staleness in complex applications.

How do I coordinate React Query caching and mutations with Zustand stores?

You coordinate caching and mutations by using structured query keys and invalidation patterns in React Query, while maintaining typed Zustand selectors for local UI state to ensure data consistency.

Does this React Query and Zustand state pattern work for form-heavy dashboards?

Yes, this state pattern works for form-heavy dashboards and collaborative interfaces. Separating server and client state ensures responsive UI and critical data consistency where frequent updates occur.

How do I set up Zustand persistence and devtools for local UI state?

You set up Zustand persistence and devtools by configuring typed stores with built-in middleware. This allows you to cache local client state across sessions and debug data flow effectively.

When should I not use Zustand for my React state management?

You should avoid using Zustand for state that belongs on the server. If your data involves frequent mutations, caching, or requires invalidation, it should be managed as server state using React Query instead.