React Zustand state management Cursor rules
React + Zustand Guidelines is a Cursor rule file on state management with Zustand stores in React and TypeScript. It helps developers decide what belongs in a store and what does not, so Zustand only holds client state that unrelated components really share.
What it does
UI state stays in components with useState or useReducer, shareable filters and tabs go in the URL, and server data stays in TanStack Query, SWR or RTK Query. Stores are small, typed slices with named actions and serializable data. Components subscribe to the smallest slice with a selector and use useShallow for multiple values.
How to use it
The globs match .ts and .tsx files.
Requirements and limits
Copying fetched server data into a store is discouraged unless an offline or draft case is documented.
More in Rules and the Cursor library.
What it covers
- State Ownership
- Store Design
- Component Usage
- TypeScript
- Updates and Middleware
- Async Actions
- SSR and React Server Components
- Testing
- Anti-Patterns
The full text is in the members library
Book a call and we will give you access to the full Cursor library: every entry in full, search by meaning, copy and download.
Source and license
Author: PatrickJS, Awesome cursorrules. License: CC0-1.0.