AgentSkillsCN

react-state-management

在构建UI组件、处理异步数据,或管理UI状态时,掌握现代React的状态管理模式。

SKILL.md
--- frontmatter
version: 4.1.0-fractal
name: react-state-management
description: 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.

React State Management

Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization.

Do not use this skill when

  • The task is unrelated to react state management
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

Use this skill when

  • Setting up global state management in a React app
  • Choosing between Redux Toolkit, Zustand, or Jotai
  • Managing server state with React Query or SWR
  • Implementing optimistic updates
  • Debugging state-related issues
  • Migrating from legacy Redux to modern patterns

Core Concepts

🧠 Knowledge Modules (Fractal Skills)

1. 1. State Categories

2. 2. Selection Criteria

3. Zustand (Simplest)

4. Pattern 1: Redux Toolkit with TypeScript

5. Pattern 2: Zustand with Slices (Scalable)

6. Pattern 3: Jotai for Atomic State

7. Pattern 4: React Query for Server State

8. Pattern 5: Combining Client + Server State

9. Do's

10. Don'ts

11. From Legacy Redux to RTK