What problem does it solve?
Provides clear, production-oriented patterns to implement, maintain, and refactor server and client state in React applications so teams avoid cache collisions, inconsistent local state, and fragile mutation logic.
Core Features & Use Cases
- Server state patterns: Query key factories, query function best practices, staleTime/gcTime strategies, refetch and retry configuration.
- Mutation and update workflows: Proper useMutation setup, optimistic updates with rollback, onMutate/onError/onSettled callbacks, and targeted invalidation.
- Client state with Zustand: Typed store creation, selectors for render performance, persist middleware, devtools integration, and combining Zustand with React Query for hybrid state.
- Advanced scenarios: Infinite and paginated queries, dependent and parallel queries, cancellation, prefetching strategies, and Suspense/ErrorBoundary integration.
Quick Start
Apply the state-management patterns to audit and improve data fetching, caching, mutation handling, and Zustand stores in your React project.