SWR

Vercel's lightweight React hooks library for data fetching using the stale-while-revalidate strategy.

SWR returns cached data immediately, then revalidates in the background, keeping UIs fast and fresh. Its single useSWR hook covers caching, focus revalidation, polling and mutation. It is smaller and simpler than TanStack Query, with fewer advanced features.

Type
Library
Category
Web
Maintainer
Vercel
First released
2019
License
Open source (MIT)
Pricing
Open source
Level
Beginner
Technologies
react, typescript
GitHub stars
32,492
Weekly downloads
27,261,005 (npm)
Latest release
[object Object]
Last verified
26 Nov 2026

What SWR is used for

  • Simple data fetching in React
  • Real-time-ish dashboards with polling

Strengths

  • Tiny API
  • Fast perceived performance
  • Works well with Next.js

Limitations

  • Fewer mutation and devtools features than TanStack Query

SWR alternatives

How it relates to other tools

Built with the same technologies

Official links

Sources

Explore