Skip to content
Back to skills

React Patterns State Collocation

ASecurity

Choose between local state, lifted state, URL state, and stores by asking who needs the data and when.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 29, 2026
ai-agentsbashreactgitfrontend

Works with

  • cli

Security analysis

A100/100

Scanned September 29, 2026

npx -y skills add aniruddhaadak80/skills --skill react-patterns-state-collocation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Patterns State Collocation?

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

Security grade badge for React Patterns State Collocation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aniruddhaadak80-react-patterns-state-collocation/badge)](https://www.skillsdirectory.com/skills/aniruddhaadak80-react-patterns-state-collocation)

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-patterns-state-collocation
description: "Choose between local state, lifted state, URL state, and stores by asking who needs the data and when."
---
# Colocate state where it is consumed

> Choose between local state, lifted state, URL state, and stores by asking who needs the data and when.

**Track:** 🎨 Frontend Engineering · **Domain:** React Patterns · **Level:** foundation · **~25 min**

**Who this is for:** Frontend Engineers, Full-Stack Developers, Design Engineers, UI Developers

## When to Use This Skill

Choose between local state, lifted state, URL state, and stores by asking who needs the data and when.
Use it whenever a matching task appears in conversation — the agent loads these instructions on demand.

## Steps

1. Start local with useState; lift only when a sibling truly needs it
2. Move shareable UI state (tab, sort, filters) into URL search params
3. Use a store only for cross-tree client state that changes often
4. Derive values during render instead of syncing via effects
5. Keep server data in a query cache, never copied into local state
6. Delete any effect whose dependency list keeps growing to mirror other state

## Common Pitfalls

- Duplicating server data into useState then fighting staleness
- Global store as default dumping ground

## Commands

**Install with skills CLI**
```bash
npx skills add aniruddhaadak80/skills --skill react-patterns-state-collocation
```

**Install globally**
```bash
npx skills add aniruddhaadak80/skills --skill react-patterns-state-collocation -g
```

---

Part of [aniruddhaadak80/skills](https://github.com/aniruddhaadak80/skills) · Browse all at https://skills.sh/aniruddhaadak80/skills

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.

Comments

Loading comments…