React Hooks for Data Fetching
Alternatives To Swr
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
a day ago43mitTypeScript
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
Swr26,88513451a day ago124September 12, 202293mitTypeScript
React Hooks for Data Fetching
React Refetch3,43615722a month ago82January 20, 202050otherJavaScript
A simple, declarative, and composable way to fetch data for React components
Use Http2,27752914 days ago101September 12, 202285mitTypeScript
🐶 React hook for making isomorphic http requests
React Async2,099400567 months ago90March 27, 202060iscJavaScript
🍾 Flexible promise-based React data loader
Rest Hooks1,794
3 days ago10apache-2.0TypeScript
Normalized state management for async data. Safe. Fast. Reusable.
Cross Fetch1,54514,3081,94212 hours ago40April 10, 202214mitJavaScript
Universal WHATWG Fetch API for Node, Browsers and React Native.
2 days ago8mitTypeScript
Request strategy library for MVVM libraries such as Vue.js, React.js and Svelte.js
React Async Hook1,13022253 months ago26September 24, 202128TypeScript
React hook to handle any async operation in React components, and prevent race conditions
Redux Query1,1031273 days ago70June 30, 20222otherJavaScript
A library for managing network state in Redux
Alternatives To Swr
Select To Compare

Alternative Project Comparisons



SWR is a React Hooks library for data fetching.

The name SWR is derived from stale-while-revalidate, a cache invalidation strategy popularized by HTTP RFC 5861. SWR first returns the data from cache (stale), then sends the request (revalidate), and finally comes with the up-to-date data again.

With just one hook, you can significantly simplify the data fetching logic in your project. And it also covered in all aspects of speed, correctness, and stability to help you build better experiences:

  • Fast, lightweight and reusable data fetching
  • Transport and protocol agnostic
  • Built-in cache and request deduplication
  • Real-time experience
  • Revalidation on focus
  • Revalidation on network recovery
  • Polling
  • Pagination and scroll position recovery
  • SSR and SSG
  • Local mutation (Optimistic UI)
  • Built-in smart error retry
  • TypeScript
  • React Suspense
  • React Native

...and a lot more.

With SWR, components will get a stream of data updates constantly and automatically. Thus, the UI will be always fast and reactive.

View full documentation and examples on swr.vercel.app.

Quick Start

import useSWR from 'swr'

function Profile() {
  const { data, error } = useSWR('/api/user', fetcher)

  if (error) return <div>failed to load</div>
  if (!data) return <div>loading...</div>
  return <div>hello {data.name}!</div>

In this example, the React Hook useSWR accepts a key and a fetcher function. The key is a unique identifier of the request, normally the URL of the API. And the fetcher accepts key as its parameter and returns the data asynchronously.

useSWR also returns 2 values: data and error. When the request (fetcher) is not yet finished, data will be undefined. And when we get a response, it sets data and error based on the result of fetcher and rerenders the component.

Note that fetcher can be any asynchronous function, you can use your favourite data-fetching library to handle that part.

View full documentation and examples on swr.vercel.app.


This library is created by the team behind Next.js, with contributions from our community:


Thanks to Ryan Chen for providing the awesome swr npm package name!


The MIT License.

Popular Fetch Projects
Popular Reactjs Projects
Popular Networking Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.