github.com/vercel/swr ↗

React Hooks for Data Fetching

An animated visualization of vercel/swr's Git history from October 2019 to February 2021, built by 99 contributors. The codebase reached 738 lines, mostly TypeScript. The video runs 58 seconds.

Render your own repo

Turn any GitHub repository into a video like this — free sample in seconds.

Visualize your own →

Open this visualization on its own page →

Language

TypeScript

Contributors

99

Lines of Code

738

From

2019-10-28

To

2021-02-14

Advertisement

About vercel/swr

SWR is a React Hooks library for data fetching created by the team behind Next.js. The name derives from "stale-while-revalidate," a cache invalidation strategy where the library returns cached data immediately while simultaneously fetching fresh data in the background. The `useSWR` hook accepts a unique key and a fetcher function, returning data, loading state, and error information to components.

The library emphasizes performance and simplicity, offering features like built-in caching, request deduplication, revalidation on focus and network recovery, polling, pagination, SSR and SSG support, local mutations for optimistic UI updates, and smart error retry logic. It works with any asynchronous fetcher function, making it transport and protocol agnostic, and supports React Suspense and React Native alongside standard React applications.

With SWR, React components receive continuous automatic data updates, keeping the UI fast and reactive. The library is built with TypeScript, lightweight, and designed to handle real-time experiences while significantly simplifying data-fetching logic across projects of any size.

Advertisement

Share this video