A React hook for managing async queues with concurrency control, retries, and cancellation. Version 3.0.1 (stable) ships TypeScript types, supports React 18.3.1+, and is ESM-only. Key differentiators: lightweight (no dependencies beyond React), declarative API using hook state, and built-in retry with exponential backoff. Alternative to TanStack Query for simpler queue scenarios.
npm install use-async-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: create a queue with concurrency 2 and retry config, enqueue an async fetch, and display queue status.
Upgrade to React 18.3.1 or later; use ESM imports.
Migrate to v3 hook signature: useAsyncQueue({ concurrency, retry }).Replace cancelQueue() with clear() from returned methods.
Ensure all functions passed to enqueue() are async or return a Promise.
Change import to named import: import { useAsyncQueue } from 'use-async-queue'Move the hook call into a functional component or a custom hook that is called from a component.