{"id":13796740,"url":"https://github.com/marcin-piela/react-fetching-library","last_synced_at":"2025-05-13T00:31:08.336Z","repository":{"id":34293434,"uuid":"175077418","full_name":"marcin-piela/react-fetching-library","owner":"marcin-piela","description":"Simple and powerful API client for react  👍 Use hooks or FACCs to fetch data in easy way. No dependencies! Just react under the hood.","archived":false,"fork":false,"pushed_at":"2023-01-04T09:50:09.000Z","size":8296,"stargazers_count":624,"open_issues_count":65,"forks_count":34,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-14T12:32:03.442Z","etag":null,"topics":["facc","fetch","fetching","fetching-data","hooks","react","react-hook","react-hooks","react-rest","react-suspense","reacthook","reacthooks","rest-api-client","rest-client","ssr","suspense"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcin-piela.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-11T20:18:42.000Z","updated_at":"2024-08-16T22:19:06.000Z","dependencies_parsed_at":"2023-01-15T06:00:27.269Z","dependency_job_id":null,"html_url":"https://github.com/marcin-piela/react-fetching-library","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcin-piela%2Freact-fetching-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcin-piela%2Freact-fetching-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcin-piela%2Freact-fetching-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcin-piela%2Freact-fetching-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcin-piela","download_url":"https://codeload.github.com/marcin-piela/react-fetching-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159879,"owners_count":17430203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["facc","fetch","fetching","fetching-data","hooks","react","react-hook","react-hooks","react-rest","react-suspense","reacthook","reacthooks","rest-api-client","rest-client","ssr","suspense"],"created_at":"2024-08-03T23:01:14.515Z","updated_at":"2024-11-18T10:31:35.484Z","avatar_url":"https://github.com/marcin-piela.png","language":"TypeScript","funding_links":[],"categories":["Data Fetching Libraries","react"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003ca target=\"_blank\" href=\"https://github.com/marcin-piela/react-fetching-library\"\u003e\n        \u003cimg src=\"/docs/_media/logo.png\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cp \u003e\nSimple and powerful fetching library for React. Use hooks to fetch data!\n\n[![Watch on GitHub][github-watch-badge]][github-watch][![Star on GitHub][github-star-badge]][github-star][![Tweet][twitter-badge]][twitter]\n\n\u003c/p\u003e\n\n---\n\n[![Build Status][build-badge]][build] [![version][version-badge]][package] ![downloads][downloads-badge] [![MIT License][license-badge]][license]\n [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] ![Code of Conduct][gzip-badge] [![codecov](https://codecov.io/gh/marcin-piela/react-fetching-library/branch/master/graph/badge.svg)](https://codecov.io/gh/marcin-piela/react-fetching-library)\n\n✅ Zero dependencies (react, react-dom as peer deps)\n\n✅ SSR support \n\n✅ Use hooks or FACC's (Function as Child Components) - depending on your needs\n\n✅ Uses Fetch API (but allows to use custom fetch implemenation and axios as well)\n\n✅ Request and response interceptors allows to easily customize connection with API\n\n✅ React Suspense support ([experimental *](#using-suspense-to-fetch-data))\n\n✅ TypeScript support \n\n✅ Error boundaries to catch bad API responses\n\n✅ Less than 3k minizipped\n\n✅ Simple cache provider - easily to extend\n\n✅ Handle race conditions\n\n✅ Allows to abort pending requests\n\n\n---\n\n# react-fetching-library\n\n\nUse hooks or FACC's (Function as Child Component) to fetch data in an easy way. No dependencies! Just React under the hood.\n\nRequest and response interceptors allows you to easily customize connection with API (add authorization, refresh token, cache, etc). It uses Fetch API so it can be used in SSR apps (i.e. with isomorphic-fetch).\n\nLibrary allows you to use it with connection of React Suspense ([read more about React Suspense](https://blog.logrocket.com/async-rendering-in-react-with-suspense-5d0eaac886c8)) to easily maintain loading state in application.\n\n## Documentation\n\nFull documentation is available __[HERE](https://marcin-piela.github.io/react-fetching-library)__ \n\n## Short example of use\n\n```js\nimport { useQuery } from 'react-fetching-library';\n\nconst fetchUsersList = {\n  method: 'GET',\n  endpoint: '/users',\n};\n\nexport const UsersListContainer = () =\u003e {\n  const { loading, payload, error, query } = useQuery(fetchUsersList);\n\n  return \u003cUsersList loading={loading} error={error} users={payload} onReload={query} /\u003e;\n};\n```\n\n[![Edit Basic Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/marcin-piela/react-fetching-library/tree/master/examples/use-query-hook?module=/src/usersList/UsersListContainer.tsx)\n\n## Typescript support\n\n\u003cimg src=\"/docs/_media/typescript.gif\" /\u003e\n\n## Inspirations\n\n- [react-fetching-data by Robin Wieruch](https://www.robinwieruch.de/react-fetching-data/)\n- [fetch-suspense](https://github.com/CharlesStover/fetch-suspense)\n- [redux-api-middleware](https://github.com/agraboso/redux-api-middleware)\n\n## Contributing\n\nFeel free to open PRs and issues to make this library better !\n\nWhen making a PR, make sure all tests pass. If you add a new feature, please consider updating the documentation or codesandbox examples. Thank you!\n\n## Using Suspense to fetch data\n\nFor now React Suspense is not production ready to use it for fetch data as described [here](https://reactjs.org/blog/2018/11/27/react-16-roadmap.html#react-16x-mid-2019-the-one-with-suspense-for-data-fetching), so API of our component/hook may change in the future. \n\n\n## License\n\nreact-fetching-library is licensed under the [MIT license](http://opensource.org/licenses/MIT).\n\n[npm]: https://www.npmjs.com/\n[node]: https://nodejs.org\n[build-badge]: https://img.shields.io/travis/marcin-piela/react-fetching-library.svg?style=flat-square\n[build]: https://travis-ci.org/marcin-piela/react-fetching-library\n[version-badge]: https://img.shields.io/npm/v/react-fetching-library.svg?style=flat-square\n[package]: https://www.npmjs.com/package/react-fetching-library\n[downloads-badge]: https://img.shields.io/npm/dm/react-fetching-library.svg?style=flat-square\n[license-badge]: https://img.shields.io/npm/l/react-fetching-library.svg?style=flat-square\n[license]: https://github.com/marcin-piela/react-fetching-library/blob/master/LICENSE\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[prs]: http://makeapullrequest.com\n[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square\n[coc]: https://github.com/marcin-piela/react-fetching-library/blob/master/CODE_OF_CONDUCT.md\n[github-watch-badge]: https://img.shields.io/github/watchers/marcin-piela/react-fetching-library.svg?style=social\n[github-watch]: https://github.com/marcin-piela/react-fetching-library/watchers\n[github-star-badge]: https://img.shields.io/github/stars/marcin-piela/react-fetching-library.svg?style=social\n[github-star]: https://github.com/marcin-piela/react-fetching-library/stargazers\n[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20react-fetching-library%20https%3A%2F%2Fgithub.com%2Fmarcin-piela%2Freact-fetching-library%20%F0%9F%91%8D\n[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/marcin-piela/react-fetching-library.svg?style=social\n[gzip-badge]:https://badgen.net/bundlephobia/minzip/react-fetching-library@1.6.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcin-piela%2Freact-fetching-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcin-piela%2Freact-fetching-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcin-piela%2Freact-fetching-library/lists"}