{"id":13450629,"url":"https://github.com/mauricedb/use-abortable-fetch","last_synced_at":"2025-04-08T17:18:05.617Z","repository":{"id":37549937,"uuid":"156375263","full_name":"mauricedb/use-abortable-fetch","owner":"mauricedb","description":"React hook that does a fetch and aborts when the components is unloaded  or a different request is made","archived":false,"fork":false,"pushed_at":"2024-10-24T05:01:02.000Z","size":5825,"stargazers_count":159,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T18:08:31.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/use-abortable-fetch","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/mauricedb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-06T11:45:07.000Z","updated_at":"2024-10-24T05:00:59.000Z","dependencies_parsed_at":"2023-02-16T04:01:26.717Z","dependency_job_id":"44523d92-ff3b-4ad5-b1c6-bf378b4bf3b1","html_url":"https://github.com/mauricedb/use-abortable-fetch","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricedb%2Fuse-abortable-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricedb%2Fuse-abortable-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricedb%2Fuse-abortable-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricedb%2Fuse-abortable-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauricedb","download_url":"https://codeload.github.com/mauricedb/use-abortable-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247888562,"owners_count":21013001,"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":[],"created_at":"2024-07-31T07:00:36.819Z","updated_at":"2025-04-08T17:18:05.590Z","avatar_url":"https://github.com/mauricedb.png","language":"TypeScript","funding_links":[],"categories":["Packages","TypeScript"],"sub_categories":[],"readme":"# use-abortable-fetch\n\n[![Build Status](https://travis-ci.org/mauricedb/use-abortable-fetch.svg?branch=master)](https://travis-ci.org/mauricedb/use-abortable-fetch) \n\nReact hook that does a fetch and aborts when the components is unloaded or a new fetch request is started.\n\n# Installation\n\n`npm install use-abortable-fetch`\nor\n`yarn add use-abortable-fetch`\n\n## Example usage:\n\n```JavaScript\nimport React from 'react';\nimport useAbortableFetch from 'use-abortable-fetch';\n\nconst ChuckNorrisJoke = () =\u003e {\n  const { data, loading, error, abort } = useAbortableFetch(\n    '//api.icndb.com/jokes/random/?limitTo=[nerdy]\u0026escape=javascript'\n  );\n\n  if (loading) return \u003cdiv\u003eLoading...\u003c/div\u003e;\n  if (error) return \u003cdiv\u003eError: {error.message}\u003c/div\u003e;\n  if (!data) return null;\n\n  return \u003cdiv\u003eJoke: {data.value.joke}\u003c/div\u003e;\n};\n\nexport default ChuckNorrisJoke;\n```\n\nSee this [CodeSandbox](https://codesandbox.io/s/n5q6xmwwq0) for a running example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricedb%2Fuse-abortable-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauricedb%2Fuse-abortable-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricedb%2Fuse-abortable-fetch/lists"}