swr vs @tanstack/react-query

@tanstack/react-query is downloaded 4.9× more often than swr (225,327,948 vs 45,601,405 per month), so it has the larger community and more answered questions online. swr ships 64% less gzipped JavaScript (4.7 kB vs 13.3 kB), which matters if bundle size is a priority. Both projects are actively maintained.

Metricswr@tanstack/react-query
Weekly downloads10,926,37551,850,189
Monthly downloads45,601,405225,327,948
GitHub stars32,39649,542
Minified size11.0 kB45.1 kB
Minified + gzipped4.7 kB13.3 kB
Dependencies21
Open issues199172
Last commit2026-05-262026-06-02
Latest version2.4.15.100.14
LicenseMITMIT

When to choose which

swr

Lightweight stale-while-revalidate data fetching.

Choose it when: Simple data fetching with caching and revalidation, when you want something lighter than React Query.

  • + Very simple API
  • + Tiny
  • + By the Next.js team
  • - Fewer features than React Query
  • - No official devtools

@tanstack/react-query

Async server-state: caching, refetching and mutations.

Choose it when: Managing data from an API — caching, background refetch, pagination, mutations. It complements (not replaces) a client store.

  • + Best-in-class server cache
  • + Great devtools
  • + Handles refetch/stale data
  • - Not for client/UI state
  • - More config than SWR

Feature comparison

Featureswr@tanstack/react-query
ParadigmAsync cache (hooks)Async server cache
First-class TypeScript✓ Yes✓ Yes
Works outside React✗ NoPartial
Dedicated devtools✗ No✓ Yes
Built-in async / server state✓ Yes✓ Yes
BoilerplateLowLow

swr

React Hooks library for remote data fetching

@tanstack/react-query

Hooks for managing, caching and syncing asynchronous and remote data in React

Related comparisons

Embed this comparison

A live badge for your README — it updates as the numbers change.

swr vs @tanstack/react-query downloads
[![swr vs @tanstack/react-query](https://devcompare.dev/badge/swr-vs-tanstack-react-query.svg)](https://devcompare.dev/compare/swr-vs-tanstack-react-query)

Data from npm, Bundlephobia and GitHub. Last updated 2026-06-02.