state-management
Installation
SKILL.md
State Management
Comprehensive patterns for managing state in modern frontend applications — from local component state to global application state.
State Categories
| Type | Description | Examples | Tool |
|---|---|---|---|
| Local | Component-scoped state | Form inputs, toggles | useState, useReducer |
| Shared | State shared between components | Selected item, filter state | Zustand, Context |
| Server | Data from APIs/database | User list, product catalog | TanStack Query, SWR |
| URL | State in the URL | Page number, search query | next/navigation, React Router |
| Persisted | State that survives refresh | Theme preference, auth token | localStorage, AsyncStorage |