
About SWR
SWR is an open source React hooks library for data fetching, built by Vercel. It caches responses and revalidates them in the background, so screens stay current.
What it does
You call useSWR with a key and a fetcher function, and it returns the data, an error and a loading state. Cached data appears instantly on repeat visits while a fresh request runs behind it. SWR revalidates when the window regains focus, when the network reconnects, and on an interval you set. Identical requests from many components are deduplicated, so only one call goes out.
Key features
- One hook that returns data, error and loading state
- Stale-while-revalidate caching
- Revalidation on focus and reconnect
- Request deduplication across components
- Small API surface and light bundle
Who it's for
React developers who want simple data fetching without a larger state library. It suits dashboards, feeds and any screen that should stay up to date.
Pricing and good to know
SWR is free and open source under the MIT license. It focuses on fetching and caching, so mutation logic is written by you. It works with any transport, so you can use it with fetch or another client library.
Highlights
- One hook that returns data, error and loading state
- Cached data shown while fresh data loads
- Revalidation on focus and network reconnect
- Requests with the same key are deduplicated
- Small API with a light bundle












