Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Frontend State Management?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ansh44233-frontend-state-management)
---
description: Choose and structure frontend state: server cache vs client state vs URL state, with minimal global stores
profile: full
tags: frontend, state, react, vue
---
# Frontend state management
Most "state management" problems are server data treated as client state.
## Classify state
- **Server state** (fetched data): use a query cache (TanStack Query, SWR, Apollo, Pinia Colada); it handles caching, dedupe, refetch and invalidation.
- **URL state** (filters, tabs, pagination): keep it in the URL so links and back button work.
- **Local UI state:** keep it in the component.
- **Global client state** (auth user, theme, cart): a small store (Zustand, Pinia, signals, context) — only this.
## Rules
- Derive, don't duplicate: compute values from a single source instead of syncing copies.
- Invalidate the right query keys after mutations; use optimistic updates with rollback for snappy UX.
## Verify
Reload the page and use back/forward on the changed screen: state that should persist does, and no request fires twice for the same data (check the network tab or query devtools).