What is this?
TanStack Query is an async state management library that simplifies fetching, caching, synchronizing, and updating server state in web apps.
Is it a framework or a library?
It's a library (a set of hooks/composables), not a framework — you drop it into an existing React, Vue, Svelte, or Solid app.
How do I add it to a project?
Install the package for your framework (e.g. @tanstack/react-query) via your package manager, wrap your app in a QueryClientProvider, and start calling useQuery/useMutation hooks.
Which frontend frameworks are supported?
React Query, Solid Query, Svelte Query, and Vue Query — it's written in TypeScript and works as JS or TS.
Does it handle the fetching logic itself?
No, it's protocol-agnostic: you bring your own fetch/GraphQL/promise-based function and TanStack Query manages the caching, refetching and lifecycle around it.
Does it work with server-side rendering?
Yes, it supports React Suspense and is designed to work with prefetching patterns used in SSR setups.
What is stale-while-revalidate and does TanStack Query use it?
Yes, it's a caching pattern where stale data is shown immediately while a background refetch updates it, which is central to how TanStack Query's cache invalidation works.
Is there devtools support?
The TanStack ecosystem includes a unified devtools panel that can be used alongside Query to inspect cache state.
Can I use it for pagination and infinite scroll?
Yes, pagination and infinite scroll are built-in supported patterns alongside prefetching and cancellation.
What other TanStack tools pair with Query?
The ecosystem includes TanStack Router for type-safe routing, TanStack Form for form state, TanStack Table for datagrids, and TanStack Start for full-stack SSR.