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.
| Metric | swr | @tanstack/react-query |
|---|---|---|
| Weekly downloads | 10,926,375 | 51,850,189✓ |
| Monthly downloads | 45,601,405 | 225,327,948✓ |
| GitHub stars | 32,396 | 49,542✓ |
| Minified size | 11.0 kB✓ | 45.1 kB |
| Minified + gzipped | 4.7 kB✓ | 13.3 kB |
| Dependencies | 2 | 1✓ |
| Open issues | 199 | 172✓ |
| Last commit | 2026-05-26 | 2026-06-02✓ |
| Latest version | 2.4.1 | 5.100.14 |
| License | MIT | MIT |
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
| Feature | swr | @tanstack/react-query |
|---|---|---|
| Paradigm | Async cache (hooks) | Async server cache |
| First-class TypeScript | ✓ Yes | ✓ Yes |
| Works outside React | ✗ No | Partial |
| Dedicated devtools | ✗ No | ✓ Yes |
| Built-in async / server state | ✓ Yes | ✓ Yes |
| Boilerplate | Low | Low |
Related comparisons
Embed this comparison
A live badge for your README — it updates as the numbers change.
[](https://devcompare.dev/compare/swr-vs-tanstack-react-query)Data from npm, Bundlephobia and GitHub. Last updated 2026-06-02.