OSS Tanbou

cache remote React data and manage revalidation, deduplication, and updates through hooks

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
32,494
Primary language
TypeScript
License
MIT
Repository last updated
Sep 22, 2026
On this page

Overview

SWR is a React data-fetching hook library built around the stale-while-revalidate pattern. It can return cached data first, revalidate in the background, and update components with fresh results while also covering request deduplication, focus and network revalidation, polling, pagination, and optimistic updates.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Return cached data first and revalidate in the background

Pass a request key and asynchronous fetcher to useSWR to reuse cached values, trigger revalidation when needed, and update the component when fresh data arrives.

Sources: [2]

Centralize revalidation, deduplication, and mutation behavior

Focus recovery, network recovery, polling, pagination, retries, and local mutation can move into a shared hook and cache layer instead of being reimplemented by each screen.

Sources: [2]

Best fit

Fits React interfaces that need shared caching and refresh behavior for API data

It is useful for profiles, dashboards, lists, and detail views where multiple components consume the same remote data and should share loading, errors, caching, and revalidation rules.

Sources: [2]

Before adoption

Define request keys and fetcher responsibilities deliberately

SWR does not force a particular HTTP client. Applications provide the fetcher, while the key also identifies cached data, so parameterized requests need stable keys that uniquely represent the requested resource.

Sources: [2]

Do not confuse the stable release with the next version on main

The latest stable release is v2.5.1, while the main branch package metadata currently reports 2.6.0-beta.0. Pin a stable version for production and avoid assuming unreleased main-branch behavior.

Sources: [4][3][6]

Official sources

  1. [1]vercel/swr repository(2026-09-30)
  2. [2]SWR v2.5.1 README(2026-09-30)
  3. [3]SWR v2.5.1 package metadata(2026-09-30)
  4. [4]SWR v2.5.1 release(2026-09-30)
  5. [5]SWR MIT license(2026-09-30)
  6. [6]SWR main package metadata(2026-09-30)
Supplemental curator note

SWR is most useful when multiple React surfaces should share caching and refresh rules instead of reimplementing them per component. Because request keys also define cache identity, parameterized requests benefit from a deliberate key strategy.

Try it in 3 steps

  1. 1

    Install SWR 2.5.1

    Add the latest stable release to an existing React project with the version pinned.

    npm install swr@2.5.1
  2. 2

    Define a fetcher

    SWR does not force an HTTP client, so provide an application fetcher that accepts the key and returns a Promise.

    const fetcher = (url) => fetch(url).then((res) => res.json());
  3. 3

    Fetch data with useSWR

    After importing useSWR from swr, pass the request key and fetcher and inspect data, loading, and error state.

    const { data, error, isLoading } = useSWR('/api/user', fetcher);
Check the official README

Growth

Growth trends · Last 30 days

32,494 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
4
Open PRs
77

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • react
  • hook
  • data-fetching
  • swr
  • suspense
  • react-native
  • fetch
  • vercel
  • stale-while-revalidate
  • hooks
  • nextjs
  • data
Stars
32,494
Forks
1,384
Watchers
216
Open issues
149
Contributors
198
Owner type
Organization
Primary language
TypeScript
License
MIT
Repository last updated
Sep 22, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?