
About TanStack Query
TanStack Query is an open source library for fetching, caching and updating server data in JavaScript apps. It manages the state that comes from APIs, separately from the rest of your app state.
What it does
Query runs your data-fetching function and stores the result in a shared cache keyed by a query key. Components that ask for the same data share one request, and stale data stays on screen while a background refresh runs. It also handles retries, refetching on window focus, garbage collection of unused data, and mutations with optimistic updates. Adapters cover React, Vue, Solid, Svelte, Angular and Lit.
Key features
- Shared cache keyed by query keys
- Background refetching of stale data
- Retries and request deduplication
- Mutations with optimistic updates
- Devtools for inspecting cache state
Who it's for
Frontend teams building apps that load data from APIs and need it to stay fresh. It suits projects where server data is the main kind of state.
Pricing and good to know
TanStack Query is free and open source under the MIT license. It manages server state only, so you may still need a separate approach for local UI state. Setup is quick, but good query key design takes planning as the app grows.
Highlights
- Shared cache keyed by query keys
- Background refetching of stale data
- Retries and request deduplication
- Mutations with optimistic updates
- Devtools for inspecting cache state












