Skip to content
Back to skills

React State Management

ASecurity

Chooses local state, context, a reducer or a store for each piece of React state and removes prop drilling without adding a library by habit.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 15, 2026
ai-agentsgoreactapi

Works with

  • api

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill react-state-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React State Management?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React State Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-react-state-management/badge)](https://www.skillsdirectory.com/skills/workspace-templates-react-state-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: react-state-management
description: Chooses local state, context, a reducer or a store for each piece of React state and removes prop drilling without adding a library by habit.
---

# React state management

Put state in the lowest place that works. Add machinery only when that fails.

## Steps

1. Inventory the state. List each piece with its owner, readers and source. Classify it: server data (from an API), URL state (filters, page, tab), form state, UI state (open, hover), or true app state (session, theme, cart).
2. Choose the home for each kind:
   - Server data goes to a query library such as TanStack Query or SWR, not to a store. Cache, refetch and invalidate there.
   - URL state lives in the router or search params so links and the back button work.
   - Form state stays in the form, or a form library for large forms.
   - UI state stays local with `useState`, lifted only to the nearest common parent.
   - Complex transitions with several related values use `useReducer` with a typed action union.
   - App state shared by distant components goes to context for rarely changing values, or a small store (Zustand, Jotai, Redux Toolkit) when many components read changing values.
3. Remove prop drilling by composition first: pass components or `children` instead of data through layers. Add context after that.
4. Split contexts by concern and by update rate. Memoize the provider value. Expose a custom hook that throws outside the provider.
5. Do not store derived data; compute it. Keep state normalized and minimal.
6. Migrate one slice per commit and run the tests after each.

## Rules

- No new dependency without saying what it replaces.
- Never mirror props into state.

## Report

A table of state, old home, new home and reason, plus what was left alone.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.