# slorber/react-async-hook

React hook to handle any async operation in React components, and prevent race conditions

Repository: https://github.com/slorber/react-async-hook
Canonical: https://ross.abutalabs.com/products/react-async-hook
Homepage: https://sebastienlorber.com/handling-api-request-race-conditions-in-react
Language: TypeScript
License Family: other
Topics: hooks
Last push: 2023-07-08T12:55:35+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2867, "days_push": 1152, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1189, forks 47 (observed 2026-08-28T04:03:55.841400+00:00)

## What it is
A tiny, feature-complete React hook library for handling async operations in components. It provides useAsync, useAsyncCallback, and useAsyncAbortable hooks that manage loading state, cancellation, and race condition prevention.

## Use cases
- fetch data in react components without race conditions
- handle async mutations with loading state in react
- cancel stale api requests when params change in react
- refetch data when dependencies change with a react hook
- manage promise state in react native apps
- prevent outdated search results from overwriting newer ones in react

## When to choose
- you want a tiny, zero-dependency alternative to react-query or swr for simple async needs
- you need fine-grained control over async state and race condition handling
- you work with react or react-native and want stable callbacks and abortable fetches
- you want a feature-complete library that will not grow in size

## When to avoid
- you need caching, retries, or a full data-fetching framework like react-query or swr
- you rely on react server components or suspense-first data fetching
- you need a library with active development and recent releases
- you want built-in devtools or cache invalidation features

## Facets
- artifact type: library
- maturity: maintenance
- function: state-management, http-client, middleware
- domain: web-development, frontend, developer-tools
- platform: cross-platform
- tags: react, react-hooks, async, race-conditions, fetch, typescript, useasync, abortion-controller, cancellation, nodejs, web-server

## Member repositories
- slorber/react-async-hook (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:55.841400+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:23:20.998201+00:00, confidence not recorded.
  - readme: https://github.com/slorber/react-async-hook (fetched 2026-08-28T04:03:55.841400+00:00, sha 360ab4ab952c)
  - homepage: https://sebastienlorber.com/handling-api-request-race-conditions-in-react (fetched 2026-08-29T12:30:28.616605+00:00, sha a248bef87b1c)
  - registry_npm: https://registry.npmjs.org/react-async-hook (fetched 2026-08-29T12:30:28.619830+00:00, sha 095e9097ee9d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
