SWR
A strong pick. 8th of 10 state and data fetching.
SWR is Vercel's small React hook library for fetching and caching server data with stale-while-revalidate. It is a solid, light choice for read-heavy React and Next.js apps, but TanStack Query does the job better for most new apps that write data, need devtools or span frameworks.
Best for: React or Next.js teams with read-heavy apps who want a tiny, simple caching hook more than a full server-state toolkit.
Scores
Overall7.0
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
SWR is a good, safe, Vercel-backed library that does read-heavy React data fetching well with very little code. For most new apps, TanStack Query does the same job better, with stronger mutations, devtools and support for more frameworks, and it is growing faster. SWR is a reasonable pick for simple Next.js apps, but not the category default.
- pkgpulse.com/guides/tanstack-query-vs-swr-2026: TanStack Query is the default for new React apps; SWR suits simpler ones
- dev.to/jake_kim_bd3065a6816799db/swr-vs-tanstack-query-2026-which-react-data-fetching-library-should-you-choose-342c: Recommends SWR for read-heavy and Next.js apps
- npm downloads ratio: 4.4 against a 4.1 median: holding ground, not gaining
GPT-6.2 Sol: 7.4, likely 6.4 to 8.4
SWR is a strong new-project choice when React screens mostly need cached reads, automatic refresh, and occasional writes. TanStack Query is the stronger default when offline mutations, automatic cache eviction, or deeper cache controls matter. The range reflects how much an app benefits from a smaller bundle and how much of its work involves advanced cache behavior.
- shoppercove.com/blog/tanstack-query-vs-swr: Current stable release had a smaller bundle in a controlled test
- tanstack.com/query/latest/docs/framework/react/comparison: TanStack Query covers more advanced cache workflows
- github.com/vercel/swr/releases: Stable fixes and continued 2.x development
- github releasesLastYear and peers TanStack Query: SWR remains active while its closest peer ships more frequently
Needed by many5.7
How many developers need a tool for this job?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
Most React apps need to fetch and cache server data, so the need is large. But SWR serves React only and caches server data, not general app state. That makes it narrower than the whole category.
- github description: React Hooks for Data Fetching: React only
- pkgpulse.com/guides/tanstack-query-vs-swr-2026: SWR is React-focused; TanStack Query is multi-framework
GPT-6.2 Sol: 5.4, likely 4.4 to 6.4
Keeping server data fresh is a common need, and 42% of respondents to the 2026 Stack Overflow web technology question reported using React. SWR serves React clients, including React Native, and focuses on server data. Surveys give a useful measure of React's reach but leave open how many apps need a separate client cache.
- survey.stackoverflow.co/2026/technology/data: React usage among web technology respondents
- github.com/vercel/swr: React and React Native server-data hooks
- nextjs.org/docs/app/getting-started/fetching-data: Client-side caching alongside built-in server fetching
Helps a lot7.2
How well does it do the job for those who need it?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
SWR does reads very well. It is small, has good TypeScript types, and supports Suspense, React 19 and RSC cache preloading. Independent comparisons agree that its mutations, invalidation of related keys and tooling are clearly behind TanStack Query. That puts it at good with clear limits.
- pkgpulse.com/guides/tanstack-query-vs-swr-2026: Basic useSWRMutation, manual invalidation, no official devtools
- dev.to/jake_kim_bd3065a6816799db/swr-vs-tanstack-query-2026-which-react-data-fetching-library-should-you-choose-342c: SWR suits simpler read-heavy apps; TanStack suits heavy writes
- github.com/vercel/swr/releases: v2.5 added RSC cache preloading and unload(); v2.6 beta adds cache tags
- npm hasTypes: Ships its own TypeScript types
GPT-6.2 Sol: 7.8, likely 6.7 to 8.8
Stable 2.5.1 has a compact typed API, request deduplication, background refresh, and optimistic rollback. Short examples give coding agents a clear starting point, though fetchers need to throw HTTP errors explicitly. An independent test found a smaller bundle than TanStack Query, but it used a synthetic workload. User reports flag infinite-list cache updates, and TanStack Query offers more cache controls and offline mutation support.
- npmjs.com/package/swr: Stable version, typed hooks, and deduplication
- swr.vercel.app/docs/mutation: Optimistic updates and rollback
- swr.vercel.app/docs/error-handling: Fetcher errors and configurable retry behavior
- shoppercove.com/blog/tanstack-query-vs-swr: Independent 2.5.1 test measured 5.6 kB gzip versus 10.4 kB
- github.com/vercel/swr/issues/4355: Open report of stale pages after overlapping refreshes
- tanstack.com/query/latest/docs/framework/react/comparison: Peer offers automatic eviction and offline mutations
Holds up over time6.9
Will it still be a good choice in two years?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
Vercel funds SWR and uses it, and releases keep coming: 10 releases last year, v2.5.1 in August 2026 and a v2.6 beta in September. It stays on v2 with few breaking changes. But commit activity is low (58 against TanStack Query's 1,897), 106 pull requests are open, and the ecosystem is moving towards TanStack Query.
- github commitsLastYear: 58 commits, far below peers
- github releasesLastYear: 10 releases; latest v2.5.1 on 2026-08-12
- github openPullRequests: 106 open pull requests
- github.com/vercel/swr/releases: Steady v2.x minor releases through 2026
GPT-6.2 Sol: 6.8, likely 5.5 to 8.0
Vercel-backed SWR recorded 58 commits and 10 GitHub releases in a year, with an August patch and a September beta. Stable releases have stayed on 2.x, and recent patches fixed cache hydration and Suspense behavior. TanStack Query ships more actively, a proposed pagination fix has been open since October, and recent releases cluster around one maintainer. The public record gives limited visibility into who else can publish or how quickly the wider backlog moves.
- github commitsLastYear, releasesLastYear, openIssues, openPullRequests: 58 commits, 10 releases, 157 open issues, and 106 open pull requests
- peers TanStack Query commitsLastYear and latestPublishedAt: 1,897 commits and a November stable release
- github.com/vercel/swr/releases: Recent 2.x fixes and a cache-tag beta, mostly released by one maintainer
- github.com/vercel/swr/pull/4357: October pagination fix remains open
- github.com/vercel/swr: Several named Vercel authors and community contributors
Used widely6.5
How many use it, and is that growing?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
SWR had 108M downloads in the last 4 weeks. Its ratio of about 4.4 is just above the 4.1 median, so it holds ground but grows far slower than TanStack Query or Zustand (about 6.9). Part of the downloads likely comes from tools that install it, such as the Vercel AI SDK's React package. Its 39k dependent repos are a solid count of real use.
- npm downloadsLast4Weeks: 108.2M, up from 24.5M a year ago (ratio 4.4)
- dependents: 39,481 repos and 1,271 packages
- peers TanStack Query downloadsLast4Weeks: 338M, ratio 6.9, which outpaces SWR
- @ai-sdk/react dependency on swr: A share of SWR's downloads comes from other tools that install it
GPT-6.2 Sol: 5.9, likely 4.8 to 7.1
Ecosyste.ms found about 39,500 dependent repositories and 1,270 packages, which puts SWR in the middle of its peer group. Downloads grew 4.42×, just above the 4.1× catalog baseline and behind TanStack Query's 6.89×. Automated installs and packages such as Vercel's React AI SDK account for some of that volume, so the number of teams actively choosing SWR remains less certain.
- dependents repos and packages: 39,481 repositories and 1,271 packages in a partial index
- npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio: 108.2 million versus 24.5 million downloads, slightly above baseline growth
- peers dependentRepos and download ratios: More indexed repositories than TanStack Query, with slower download growth
- github stars, bluesky posts, peers blueskyPosts: 32,497 stars and five Bluesky links, versus 39 links for TanStack Query
- raw.githubusercontent.com/vercel/ai/main/packages/react/package.json: Vercel's React AI SDK installs SWR transitively for its users
Vouched for6.5
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
Vercel builds and uses SWR, and many Next.js apps run it in production. Independent write-ups call it production-ready for read-heavy apps. In the State of React 2025 survey it trails TanStack Query, which leads data fetching on use and positive sentiment. Social attention is low: 5 Bluesky posts and no Hacker News stories.
- theregister.com/2026/02/17/react_survey_shows_tanstack_gains: TanStack Query leads the survey at 68% use; SWR is not highlighted
- pkgpulse.com/guides/tanstack-query-vs-swr-2026: Calls both production-ready, with TanStack the default for new apps
- bluesky posts: 5 posts against 39 for TanStack Query
GPT-6.2 Sol: 6.9, likely 5.7 to 8.0
Next.js documents SWR for client-side fetching, and Dub declares it as a direct dependency. An independent benchmark supports the small bundle, and some users report years of satisfactory use. Feedback on advanced caching is mixed, and TanStack Query leads satisfaction in State of React 2025.
- nextjs.org/docs/app/getting-started/fetching-data: Vercel's framework documents SWR as a client-fetching option
- raw.githubusercontent.com/dubinc/dub/main/apps/web/package.json: Dub's web app declares SWR directly
- shoppercove.com/blog/tanstack-query-vs-swr: Independent bundle and cache measurements
- reddit.com/r/reactjs/comments/1iz34wx/reactquery_or_swr: Users report long-term use and difficulty mutating infinite lists
- 2025.stateofreact.com/en-US/libraries/data-loading: TanStack Query leads data-loading satisfaction
Safe7.5
How safe is it to depend on?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
SWR has no advisories, only two runtime dependencies and an MIT licence. Its OpenSSF Scorecard is a middling 5.5, with zero on token permissions, pinned dependencies and fuzzing. Its releases come from Vercel's CI.
- advisories total: 0 advisories
- npm dependencies: 2 runtime dependencies
- scorecard score: 5.5; Token-Permissions and Pinned-Dependencies score 0
- npm license: MIT
GPT-6.2 Sol: 7.4, likely 6.2 to 8.5
SWR has an MIT licence, two runtime dependencies, and zero advisories in the collected OSV record. The project has a security policy and switched npm releases to trusted publishing in June. OpenSSF scored it 5.5, with zeroes for workflow token permissions, dependency pinning, and fuzzing. Those gaps and limited visibility into release access keep the range wide.
- npm license and dependencies: MIT and two runtime dependencies
- advisories total and last24Months: Zero OSV advisories in the snapshot
- scorecard score and checks: 5.5 overall, strong security policy, and weak workflow controls
- github.com/vercel/swr/pull/4274: Merged switch to npm trusted publishing using OIDC
Good
- It is very small (about 4-5 KB gzipped) and has only two runtime dependencies.
- The API is simple: useSWR(key, fetcher) gives caching, deduplication, focus revalidation and polling.
- It works closely with Next.js, including new RSC cache preloading in v2.5.
- Vercel backs it, and it has no known security advisories.
Bad
- Mutations are basic: optimistic updates, rollback and invalidation are built by hand.
- There are no official devtools, and invalidating many related keys at once is awkward.
- It works only with React, while TanStack Query also covers Vue, Solid, Svelte and Angular.
- Development is slow: 58 commits last year and over 100 open pull requests.
The numbers
- npm downloads, 4 weeks
- 108M ×4.4 in a year
- GitHub stars
- 32k
- Commits, 12 months
- 58
- npm version
- 2.5.1 Aug 2026
- Versions, 12 months
- 7
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 5.5 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (vercel/swr), npm (swr), 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