# vercel/swr

React Hooks for Data Fetching

Repository: https://github.com/vercel/swr
Canonical: https://ross.abutalabs.com/products/swr
Homepage: https://swr.vercel.app
Language: TypeScript
License: MIT
License Family: permissive
Topics: react, hook, data-fetching, swr, suspense, react-native, fetch, vercel, stale-while-revalidate, hooks, nextjs, data, cache
Last push: 2026-08-23T11:35:07+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 85, longevity 100
- inputs: {"age_days": 2501, "days_push": 10, "days_rel": 21, "gap_med": 37, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 32473, forks 1382 (observed 2026-08-28T04:11:57.571467+00:00)

## What it is
SWR is a React Hooks library for data fetching, named after the stale-while-revalidate caching strategy. It returns cached data first, then revalidates in the background, providing built-in caching, request deduplication, revalidation on focus/reconnect, polling, pagination, optimistic UI, and React Suspense support.

## Use cases
- fetch data in react components with a single hook
- cache and deduplicate api requests in a react app
- revalidate data when the window regains focus
- implement optimistic ui updates with local mutation
- add polling and real-time-ish data refresh to a dashboard
- share one request across many components
- handle pagination and scroll position recovery
- server-side render data fetching with nextjs

## When to choose
- you're building a React or React Native app that consumes REST or any async data source
- you want lightweight data fetching with automatic caching and revalidation
- you use Next.js and want SSR/SSG-friendly client data fetching
- you prefer a minimal hook-based API over heavier query libraries

## When to avoid
- your app doesn't use React (SWR hooks are React-specific)
- you need complex normalized caching or GraphQL fragments - consider Apollo or similar
- you need server-side state management rather than client data fetching
- you're on Vue, Svelte, or Angular - use TanStack Query or framework-native options instead

## Facets
- artifact type: library
- maturity: stable
- function: http-client, caching, state-management, web-framework
- domain: web-development, frontend, apis
- platform: cross-platform
- tags: react, react-hooks, data-fetching, stale-while-revalidate, suspense, react-native, nextjs, typescript, vercel, swr, nodejs, web-server

## Member repositories
- vercel/swr (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:57.571467+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:52:06.070922+00:00, confidence not recorded.
  - readme: https://github.com/vercel/swr (fetched 2026-08-28T04:11:57.571467+00:00, sha a92586b36c6a)
  - homepage: https://swr.vercel.app (fetched 2026-08-29T07:49:23.400180+00:00, sha 0ac16643246d)
  - site_page: https://vercel.com/docs (fetched 2026-08-29T07:49:23.409795+00:00, sha 614e0cfe00de)
  - site_page: https://vercel.com/about (fetched 2026-08-29T07:49:23.411884+00:00, sha c78127d6b6a3)
  - site_page: https://vercel.com/docs/frameworks/full-stack/nuxt (fetched 2026-08-29T07:49:23.417329+00:00, sha 3e48525fbcdd)
  - site_page: https://vercel.com/docs/frameworks/full-stack/sveltekit (fetched 2026-08-29T07:49:23.419380+00:00, sha fec9e6e22eeb)
  - site_page: https://vercel.com/docs/frameworks/backend/nitro (fetched 2026-08-29T07:49:23.421540+00:00, sha f304c099ad65)
  - site_page: https://vercel.com/docs/frameworks/full-stack/tanstack-start (fetched 2026-08-29T07:49:23.423338+00:00, sha fb46d1029e2d)
  - site_page: https://vercel.com/changelog (fetched 2026-08-29T07:49:23.413776+00:00, sha 002ff21b7089)
  - site_page: https://vercel.com/pricing (fetched 2026-08-29T07:49:23.415516+00:00, sha 1621cac99317)
- Data as of 2026-08-30T08:39:29.467469+00:00.
