SWR
A React data-fetching library from Vercel, named after the stale-while-revalidate strategy: show cached data at once, then refresh it in the background.
In more detail
The strategy comes from an HTTP caching directive. Like TanStack Query, SWR deduplicates requests and can work with Suspense.
Related terms
- stale-while-revalidate — A caching strategy that answers immediately from the cache, even if out of date, while fetching a fresh copy in the background for next time.
- data fetching — Loading the data a page needs, such as products or user details, from a database or API.
- TanStack Query — A library that fetches, caches and refreshes server data in frontend apps, and runs changes to it as mutations.
- cache — A store of earlier answers kept close to where they are needed so they can be reused instead of fetched or computed again.
Taught in
- Async Data Fetching: Parallel Requests & Preloading — Next.js 15 & Modern App Router Architecture
- Client-Side Data Fetching Architectures with Suspense — React 19 & Modern Component Architecture