The name “SWR” is derived from stale-while-revalidate, a HTTP cache invalidation strategy popularized by HTTP RFC 5861. SWR is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data. With SWR, components will get a stream of data updates constantly and automatically. And the UI will be always fast and reactive. With just one single line of code, you can simplify the logic of data fetching in your project, and also have all many amazing features out-of-the-box. SWR has you covered in all aspects of speed, correctness, and stability to help you build better experiences. Fast page navigation, polling on interval, data dependency, revalidation on focus, revalidation on network recovery, local mutation (Optimistic UI), smart error retry, pagination and scroll position recovery, React Suspense, and more.

Features

  • Jamstack oriented
  • Fast, lightweight and reusable data fetching
  • Built-in cache and request deduplication
  • Real-time experience
  • Transport and protocol agnostic
  • TypeScript ready
  • React Native

Project Samples

Project Activity

See All Activity >

Categories

Search, Libraries

License

MIT License

Follow SWR

SWR Web Site

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of SWR!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Search Software, TypeScript Libraries

Registered

2021-03-22