TanStack Query
The default choice. 1st of 10 state and data fetching.
TanStack Query is the leading library for fetching, caching and syncing server data in React, with bindings for Vue, Solid, Svelte and Angular. For a new app that talks to an API, it is the default choice today. Pair it with a small client-state store such as Zustand if you also need one.
Best for: Any React or other front-end team that needs cached, fresh server data, with mutations, pagination and SSR hydration, from REST or RPC APIs.
Scores
Overall9.0
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 9.0, likely 8.0 to 9.5
It is the category's default for server state: the deepest feature set, very active upkeep, the strongest survey standing, and growth above the median. It does not replace a client-state store, and the 2026 org-level supply-chain incident keeps it below a perfect score. Among its peers it ranks first for data fetching, alongside Zustand for client state.
- heise.de/-11197819: Top library in State of React 2025
- npm downloadsLast4Weeks: 6.9x year-on-year growth
- tanstack.com/blog/npm-supply-chain-compromise-postmortem: Org incident, with Query packages clean
GPT-6.2 Sol: 8.9, likely 7.8 to 9.6
TanStack Query is my default for new React apps that need a client-side server data cache with mutations and background refreshes. Active maintenance and production use support that choice. SWR has an appeal for small bundles, and RTK Query fits teams that already organize app state around Redux. The range reflects how much the app needs those tradeoffs and how much shared UI state it must manage separately.
- github.com/tanstack/query/releases: Current stable releases across React, core, and other adapters.
- 2025.stateofreact.com/en-US/libraries/data-loading: Leading satisfaction and rising usage among respondents.
- github.com/bluesky-social/social-app/blob/main/src/state/queries/feed.ts: A production example with pagination and mutations.
- shoppercove.com/blog/tanstack-query-vs-swr: SWR shipped less JavaScript in the benchmark’s tested setup.
- redux.js.org/toolkit/rtk-query/overview: RTK Query integrates data fetching and caching with a Redux store.
Needed by many7.0
How many developers need a tool for this job?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
Most web apps fetch server data and benefit from caching it, so a large share of front-end developers need this job done. The rated package is React-only. The repository also serves Vue, Solid, Svelte and Angular. It does not cover general client state, which is narrower than the full category.
- github description: Covers React, Solid, Svelte and Vue adapters
- heise.de/-11197819: Most-used library in State of React 2025
GPT-6.2 Sol: 7.0, likely 5.9 to 8.1
Keeping API data fresh is a common need in interactive web and mobile apps. The measured package serves React and React Native, and the larger project also ships adapters for Vue, Solid, Svelte, and Angular. The range reflects how often built-in framework fetching is sufficient and how much an app relies on shared client-side state.
- survey.stackoverflow.co/2026/technology/data: React reached 41.5% of respondents to the web technology question.
- github.com/tanstack/query/releases: The current release lists adapters across several UI frameworks.
- github.com/TanStack/query/blob/main/docs/framework/react/guides/advanced-ssr.md: The guide identifies where framework fetching can cover Server Component apps.
- reddit.com/r/reactnative/comments/1snoh1m/do_you_use_tanstack_query_swr_for_rn: React Native users describe caching and persistence in their apps.
Helps a lot9.0
How well does it do the job for those who need it?
Claude Opus 5.5: 9.0, likely 8.0 to 10.0
It is the most complete server-state tool in the category: caching, staleness control, mutations, infinite queries, SSR hydration, offline persistence and devtools. Its types are strong, its documentation is extensive, and AI agents write it correctly because the patterns are so common. Comparisons favour it over SWR for mutations, and it lacks only a normalized cache.
- blog.logrocket.com/swr-vs-tanstack-query-react: Independent comparison favours its mutation handling
- tanstack.com/query/latest/docs/framework/react/comparison: Feature table against SWR, RTK Query and Apollo
- docs.bswen.com/blog/2026-03-03-react-data-fetching-libraries-comparison: 2026 comparison recommends it for new projects
GPT-6.2 Sol: 8.9, likely 7.8 to 9.6
Stable React Query 5.108.2 handles caching, pagination, retries, and optimistic updates with strong type inference. The docs give coding agents a clear API to follow, though choosing query keys and invalidating data correctly still requires app context. A recent benchmark found similar first-fetch times and a smaller bundle for SWR on the tested imports. An open report of stale combined query results leaves some uncertainty around complex subscriptions.
- github.com/TanStack/query/releases/tag/@tanstack%2Freact-query@5.108.2: Confirms the stable React build under review.
- tanstack.com/query/latest/docs/framework/react/guides/optimistic-updates: Documents optimistic UI updates and cache rollback.
- github.com/TanStack/query/blob/main/docs/framework/react/typescript.md: Shows inferred result types and reusable typed query options.
- tanstack.com/query/latest/docs/framework/react/guides/important-defaults: Explains freshness, automatic refetches, retries, and cache lifetime.
- reddit.com/r/reactjs/comments/1wsh5dd/colleague_says_invalidatequeries_is_overkill_and: Users describe the tradeoffs of maintaining query keys and invalidation.
- shoppercove.com/blog/tanstack-query-vs-swr: October 2026 benchmark measured 10.4 KB versus 5.6 KB gzip.
- github.com/TanStack/query/issues/12626: Open report of stale results in a combined query.
Holds up over time8.9
Will it still be a good choice in two years?
Claude Opus 5.5: 9.0, likely 8.0 to 10.0
The repository had 1,897 commits last year, has 1,154 contributors, and only 42 issues are open. Releases are frequent and there is a long-running team behind it. TanStack is funded by sponsors and partners, and v5 has stayed stable for years, with v6 work only exploratory. The ecosystem is moving toward the wider TanStack family, not away from it.
- github commitsLastYear: 1897 commits in the last year
- github openIssues: 42 open against 2371 closed
- npm versionsLastYear: 82 versions, latest on 2026-11-20
- TanStack maintainers: Tanner Linsley and TkDodo lead it, with partner funding
GPT-6.2 Sol: 8.8, likely 7.5 to 9.6
The React package published 82 versions in a year, and recent core fixes show active maintenance by several contributors. TanStack reports funding from sponsors, partnerships, and companies that use its tools. The v5 upgrade required downstream projects to replace query callbacks, and patch releases can change types. Public release and issue records leave uncertainty about typical response times and how many maintainers can authorize releases.
- npm versionsLastYear: 82 React package versions, including coordinated releases.
- github commitsLastYear and releasesLastYear: 1,897 commits and 1,863 release entries across the monorepo.
- github.com/TanStack/query/blob/main/packages/query-core/CHANGELOG.md: Recent fixes cover selector errors, retries, and infinite queries.
- github.com/TanStack/query/issues: 42 open issues, including recent React and core reports.
- tanstack.com/ads: TanStack describes its funding sources.
- github.com/refinedev/refine/issues/6878: A downstream framework recorded concrete v5 migration work.
- github.com/TanStack/query/blob/main/docs/framework/react/typescript.md: Documents that type changes can ship in patch releases.
Used widely8.3
How many use it, and is that growing?
Claude Opus 5.5: 9.0, likely 8.0 to 10.0
It had about 338M downloads in 4 weeks, up 6.9x on a year before. That is well above the 4.1 median, and only Zustand is close. Some installs come in through TanStack Router, tRPC and code generators. The 21,873 dependent repos are fewer than Redux Toolkit's or Zustand's, probably partly because the package is scoped and newer, but the trend and surveys show it is widely chosen.
- npm downloadsLast4Weeks: 337.9M, against 49.1M a year before
- medianDownloadsRatio: Its 6.9x ratio beats the 4.1 median
- dependents repos: 21,873 repos, lower than Zustand and RTK
- github stars: 50.6k stars
GPT-6.2 Sol: 7.5, likely 6.0 to 8.6
Four-week downloads grew 6.89× year over year, above the 4.1× catalog baseline and roughly even with Zustand. Ecosyste.ms tracks 21,873 repositories and 1,082 packages, with fewer tracked repositories than Redux Toolkit, Zustand, or SWR. Automated and downstream installs inflate npm counts, while stars and Bluesky links cover the whole Query monorepo. The download trend and survey both point to growth, with incomplete repository coverage leaving the number of direct choices uncertain.
- npm downloadsLast4Weeks and downloadsSame4WeeksYearAgo: 337.9 million downloads versus 49.1 million a year earlier.
- medianDownloadsRatio: The catalog’s year-over-year baseline is 4.1×.
- dependents repos and packages: 21,873 tracked repositories and 1,082 tracked packages.
- peers: Second in downloads and seventh in tracked dependent repositories.
- github stars and bluesky posts: 50,603 stars and 39 Bluesky posts across the Query project.
- 2025.stateofreact.com/en-US/libraries/data-loading: Survey respondents report rising TanStack Query usage.
- github.com/refinedev/refine/blob/main/documentation/docs/migration-guide/4x-to-5x.md: Refine v5 requires React Query, illustrating downstream installs.
Vouched for9.0
Who stands behind it being good?
Claude Opus 5.5: 9.0, likely 8.0 to 10.0
It ranked first among libraries in State of React 2024 and again in 2025, with strong positive and very low negative sentiment. Independent comparisons recommend it, and tRPC, Orval, hey-api and TanStack Router build on it. Survey samples are self-selected, so the range stays one point wide.
- heise.de/-11197819: Kept first place in State of React 2025
- certificates.dev/blog/breaking-down-state-of-react-2025-results: Leads data fetching with strong positive sentiment
- hackerNews top: Ecosystem tools such as Orval and TanStack DB build on it
GPT-6.2 Sol: 9.0, likely 7.9 to 9.7
TanStack Query led satisfaction among the data-loading libraries in State of React 2025. Bluesky uses it in its feed and Supabase Studio ships it in its dashboard. Refine v5 builds its data hooks on it, and an independent benchmark adds evidence on bundle size and fetch performance. The survey samples React developers, and the benchmark covers a narrow set of workloads.
- 2025.stateofreact.com/en-US/libraries/data-loading: Highest satisfaction ratio among the tracked data-loading tools.
- github.com/bluesky-social/social-app/blob/main/src/state/queries/feed.ts: Bluesky uses Query for paginated feeds and mutations.
- github.com/supabase/supabase/blob/master/apps/studio/package.json: Supabase Studio declares React Query v5 as a dependency.
- github.com/refinedev/refine/blob/main/documentation/docs/data/data-provider/index.md: Refine uses TanStack Query for data fetching and invalidation.
- shoppercove.com/blog/tanstack-query-vs-swr: Independent October 2026 measurements compare React Query and SWR.
Safe7.9
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
It has no advisories, one dependency and an MIT licence. In May 2026, attackers used cache poisoning and OIDC token theft in TanStack's CI to publish malicious versions of 42 Router and Start packages. The postmortem confirms the Query packages were clean, and the CI was hardened afterwards. There is no Scorecard data, and the incident shows real org-level supply-chain risk.
- advisories total: 0 advisories
- npm dependencies: 1 dependency (query-core)
- tanstack.com/blog/npm-supply-chain-compromise-postmortem: Router/Start compromised, @tanstack/query* confirmed clean
- security.snyk.io/TanStack-npm-Supply-Chain-Compromise-May-2026: Mini Shai-Hulud campaign hit @tanstack packages
- scorecard: No Scorecard data
GPT-6.2 Sol: 8.7, likely 7.4 to 9.6
The MIT-licensed React package has one runtime dependency, TanStack Query Core, and the bundle shows zero OSV advisories. Query’s release workflow uses GitHub Actions with short-lived credentials for npm publishing. The May compromise affected TanStack Router and Start packages, and the August incident affected a third-party code generator. The missing OpenSSF Scorecard and limited visibility into release permissions widen the range.
- advisories total and scorecard: Zero collected OSV advisories and no Scorecard result.
- github.com/TanStack/query/blob/8b2e8af/packages/react-query/package.json: MIT license and one runtime dependency.
- github.com/TanStack/query/blob/main/.github/workflows/release.yml: Query’s release job uses OIDC and pins checkout to a commit.
- tanstack.com/blog/incident-followup: Describes trusted npm publishing, hardening, and Query’s unaffected status.
- github.com/advisories/GHSA-g7cv-rxg3-hmpx: Lists affected Router and Start packages and their patched versions.
- aikido.dev/blog/popular-code-generator-for-tanstack-query-hit-by-supply-chain-worm: Identifies the August incident as affecting a third-party code generator.
Good
- Caching, background refetch, deduplication, retries, infinite queries and optimistic mutations all work out of the box with sensible defaults.
- TypeScript types are excellent, and queryOptions makes keys and data types reusable and safe.
- Very active upkeep: v5 has had no breaking major in years, and maintainers close issues fast (42 open of about 2,400).
- Adapters for React, Vue, Solid, Svelte and Angular, plus devtools and a large ecosystem of code generators (Orval, hey-api, tRPC).
Bad
- It manages server state only, so purely client-side state still needs another tool.
- No normalized cache, so related queries must be invalidated by hand, unlike Apollo for GraphQL.
- The bundle is larger than SWR's, at about 13 KB gzipped against about 4 KB.
- In May 2026 attackers published malicious versions of 42 @tanstack packages through the shared org's CI. Query packages were confirmed clean, but the incident shows org-level risk.
The numbers
- npm downloads, 4 weeks
- 338M ×6.9 in a year
- GitHub stars
- 51k
- Commits, 12 months
- 1.9k
- npm version
- 5.108.2 Nov 2026
- Versions, 12 months
- 82
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- MIT
Read on 21 November 2026 from GitHub (TanStack/query), npm (@tanstack/react-query), OSV and the OpenSSF Scorecard.
State and data fetching
- 9.0TanStack Query
- 8.5Zustand
- 8.0Pinia
- 7.6Jotai
- 7.6Redux Toolkit
- 7.5Apollo Client
- 7.3XState
- 7.0SWR
- 6.7MobX
- 6.5Valtio