[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1971":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},1971,"swr","vercel\u002Fswr","vercel","React Hooks for Data Fetching","https:\u002F\u002Fswr.vercel.app",null,"TypeScript",32399,1347,212,146,0,7,32,5,44.39,"MIT License",false,"main",[25,26,27,28,29,30,31,32,33,34,35,5,7],"cache","data","data-fetching","fetch","hook","hooks","nextjs","react","react-native","stale-while-revalidate","suspense","2026-06-12 02:00:35","[![SWR](https:\u002F\u002Fassets.vercel.com\u002Fimage\u002Fupload\u002Fv1572289618\u002Fswr\u002Fbanner.png)](https:\u002F\u002Fswr.vercel.app)\n\n\u003Cp align=\"center\">\n  \u003Ca aria-label=\"Vercel logo\" href=\"https:\u002F\u002Fvercel.com\">\n    \u003Cimg src=\"https:\u002F\u002Fbadgen.net\u002Fbadge\u002Ficon\u002FMade%20by%20Vercel?icon=zeit&label&color=black&labelColor=black\">\n  \u003C\u002Fa>\n  \u003Cbr\u002F>\n  \u003Ca aria-label=\"NPM version\" href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fswr\">\n    \u003Cimg alt=\"\" src=\"https:\u002F\u002Fbadgen.net\u002Fnpm\u002Fv\u002Fswr\">\n  \u003C\u002Fa>\n  \u003Ca aria-label=\"Package size\" href=\"https:\u002F\u002Fbundlephobia.com\u002Fresult?p=swr\">\n    \u003Cimg alt=\"\" src=\"https:\u002F\u002Fbadgen.net\u002Fbundlephobia\u002Fminzip\u002Fswr\">\n  \u003C\u002Fa>\n  \u003Ca aria-label=\"License\" href=\"https:\u002F\u002Fgithub.com\u002Fvercel\u002Fswr\u002Fblob\u002Fmain\u002FLICENSE\">\n    \u003Cimg alt=\"\" src=\"https:\u002F\u002Fbadgen.net\u002Fnpm\u002Flicense\u002Fswr\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n## Introduction\n\nSWR is a React Hooks library for data fetching.\n\nThe name “**SWR**” is derived from `stale-while-revalidate`, a cache invalidation strategy popularized by [HTTP RFC 5861](https:\u002F\u002Ftools.ietf.org\u002Fhtml\u002Frfc5861).\n**SWR** first returns the data from cache (stale), then sends the request (revalidate), and finally comes with the up-to-date data again.\n\nWith 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:\n\n- **Fast**, **lightweight** and **reusable** data fetching\n- Transport and protocol agnostic\n- Built-in **cache** and request deduplication\n- **Real-time** experience\n- Revalidation on focus\n- Revalidation on network recovery\n- Polling\n- Pagination and scroll position recovery\n- SSR and SSG\n- Local mutation (Optimistic UI)\n- Built-in smart error retry\n- TypeScript\n- React Suspense\n- React Native\n\n...and a lot more.\n\nWith SWR, components will get **a stream of data updates constantly and automatically**. Thus, the UI will be always **fast** and **reactive**.\n\n---\n\n**View full documentation and examples on [swr.vercel.app](https:\u002F\u002Fswr.vercel.app).**\n\n\u003Cbr\u002F>\n\n## Quick Start\n\n```js\nimport useSWR from 'swr'\n\nfunction Profile() {\n  const { data, error, isLoading } = useSWR('\u002Fapi\u002Fuser', fetcher)\n\n  if (error) return \u003Cdiv>failed to load\u003C\u002Fdiv>\n  if (isLoading) return \u003Cdiv>loading...\u003C\u002Fdiv>\n  return \u003Cdiv>hello {data.name}!\u003C\u002Fdiv>\n}\n```\n\nIn this example, the React Hook `useSWR` accepts a `key` and a `fetcher` function.\nThe `key` is a unique identifier of the request, normally the URL of the API. And the `fetcher` accepts\n`key` as its parameter and returns the data asynchronously.\n\n`useSWR` also returns 3 values: `data`, `isLoading` and `error`. When the request (fetcher) is not yet finished,\n`data` will be `undefined` and `isLoading` will be `true`. When we get a response, it sets `data` and `error` based on the result\nof `fetcher`, `isLoading` to false and rerenders the component.\n\nNote that `fetcher` can be any asynchronous function, you can use your favourite data-fetching\nlibrary to handle that part.\n\n---\n\n**View full documentation and examples on [swr.vercel.app](https:\u002F\u002Fswr.vercel.app).**\n\n\u003Cbr\u002F>\n\n## Authors\n\nThis library is created by the team behind [Next.js](https:\u002F\u002Fnextjs.org), with contributions from our community:\n\n- Shu Ding ([@shuding\\_](https:\u002F\u002Fx.com\u002Fshuding_)) - [Vercel](https:\u002F\u002Fvercel.com)\n- Jiachi Liu ([@huozhi](https:\u002F\u002Fx.com\u002Fhuozhi)) - [Vercel](https:\u002F\u002Fvercel.com)\n- Guillermo Rauch ([@rauchg](https:\u002F\u002Fx.com\u002Frauchg)) - [Vercel](https:\u002F\u002Fvercel.com)\n- Joe Haddad ([@timer150](https:\u002F\u002Fx.com\u002Ftimer150)) - [Vercel](https:\u002F\u002Fvercel.com)\n- Paco Coursey ([@pacocoursey](https:\u002F\u002Fx.com\u002Fpacocoursey)) - [Vercel](https:\u002F\u002Fvercel.com)\n\n[Contributors](https:\u002F\u002Fgithub.com\u002Fvercel\u002Fswr\u002Fgraphs\u002Fcontributors)\n\nThanks to Ryan Chen for providing the awesome `swr` npm package name!\n\n\u003Cbr\u002F>\n\n## License\n\nThe MIT License.\n","SWR 是一个用于数据获取的 React Hooks 库。它基于 `stale-while-revalidate` 缓存策略，先从缓存中返回旧数据，然后发送请求更新数据，确保用户界面始终快速响应且数据最新。其核心功能包括轻量级的数据获取、内置缓存和请求去重、实时体验、自动重验证以及对各种网络状态的支持。此外，SWR 支持 TypeScript、React Suspense 和 React Native，并提供了丰富的功能如本地突变（乐观 UI）、智能错误重试等。适用于需要高效、稳定且实时数据更新的应用场景，如社交应用、在线协作工具或任何需要频繁数据刷新的 Web 或移动应用。",2,"2026-06-11 02:47:07","top_all"]