{"repo":"vercel/swr","free":true,"listed":false,"github":"https://github.com/vercel/swr","clone":"git clone https://github.com/vercel/swr.git","description":"React Hooks for Data Fetching","language":"TypeScript","stars":32456,"topics":["react","hook","data-fetching","swr","suspense","react-native","fetch","vercel","stale-while-revalidate","hooks"],"license":"MIT","category":"mobile-apps","readme_excerpt":"Introduction 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 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 3 values: data , isLoading and error . When the request (fetcher) is not yet finished, data will be undefined and isLoading w","default_branch":null,"files":null,"tree":[],"storefront":"/r/vercel","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/vercel/swr/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}