What problem does it solve?
TanStack Query solves the challenge of fetching, caching, synchronizing, and updating server state in TS/JS apps so your UI stays responsive and consistent.
Core Features & Use Cases
- Query Keys & Invalidation: Organizes cached data with hierarchical, serializable query keys and invalidates by prefix for predictable refresh behavior (e.g., invalidate all "todos" queries after a change).
- Data Fetching Patterns: Covers queries, mutations, infinite scrolling, pagination, dependent queries, and parallel queries for common client-side server-data workflows.
- Performance & UX Controls: Provides staleTime, gcTime, retry, refetching rules, optimistic updates, and Suspense integration to reduce loading states and race conditions.
Quick Start
Use the tanstack-query setup guide to add QueryClientProvider to your React app, then create a useQuery call with a stable queryKey and a queryFn that fetches your server data.