TanStack Query
Powerful asynchronous state management for data fetching, caching, and synchronization in React, Vue, Solid and Svelte.
Version: v5.32
Official Documentation ↗Installation
npm
npm install @tanstack/react-querypnpm
pnpm add @tanstack/react-queryyarn
yarn add @tanstack/react-queryMethods
No methods match this filter.
FAQ
- Is TanStack Query a replacement for Redux or Zustand?
- No. TanStack Query manages server state (data fetched from APIs), while Redux/Zustand manage client state (UI state, form state). They complement each other and are often used together.
- How does automatic caching work?
- Each query is cached by its queryKey. When the same key is requested again, cached data is shown immediately while a background refetch occurs if the data is stale. Stale time and cache time are configurable per query.
- Does it work outside of React?
- Yes. TanStack Query has framework-specific packages for React, Vue, Solid, and Svelte. The core @tanstack/query-core package is framework-agnostic.
Report a problem with this API docOpens a pre-filled issue on GitHub.