React state management

From HoangNguyen0403/agent-skills-standard · View interactive version

React state management is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Select and implement local, global, and server state patterns in React. Use when choosing or implementing state management (Context, Zustand, Redux, React Query) in React.

How to use this skill

Skill file

React State Management

**Priority: P0 (CRITICAL)**

Implementation Guidelines

Boundary note: hooks skill covers primitive API usage (useMemo, useCallback rules). This skill covers _architectural_ state decisions — which tool to use for which state scope.

function LikeButton({
  postId,
  initialLiked,
}: {
  postId: string;
  initialLiked: boolean;
}) {
  const [optimisticLiked, setOptimisticLiked] = useOptimistic(initialLiked);
  return (
    <button
      onClick={async () => {
        setOptimisticLiked(!optimisticLiked);
        await toggleLike(postId);
      }}
    >
      {optimisticLiked ? "Liked" : "Like"}
    </button>
  );
}

Verify

Reference & Examples

For Zustand, Redux Toolkit, and TanStack Query patterns:

See references/REFERENCE.md.

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.