# @ahooksjs/use-request

> React Hooks for fetching, caching and updating asynchronous data

Latest version **2.8.15** (published 2021-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ahooksjs/use-request
pnpm add @ahooksjs/use-request
yarn add @ahooksjs/use-request
bun add @ahooksjs/use-request
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.8.15 |
| Published | 2021-12-07 |
| First published | 2020-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 126.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14974 |
| Maintainers | chenbin93, fan576679268, tli4, awmleer, monkindey |

## Links

- npm: https://www.npmjs.com/package/@ahooksjs/use-request
- Repository: https://github.com/alibaba/hooks
- Issues: https://github.com/alibaba/hooks/issues
- npm.io page: https://npm.io/package/@ahooksjs/use-request

## Dependencies (2)

- [lodash.debounce](https://npm.io/package/lodash.debounce.md) ^4.0.8
- [lodash.throttle](https://npm.io/package/lodash.throttle.md) ^4.1.1

## Recent versions

- 2.8.15 (latest) — 2021-12-07
- 3.0.0-alpha.0 (alpha) — 2021-07-26
- 2.8.11-beta (beta) — 2021-07-23
- 2.8.14 — 2021-12-02
- 2.8.13 — 2021-10-26
- 2.8.12 — 2021-09-24
- 2.8.11 — 2021-09-21
- 2.8.10 — 2021-07-22
- 2.8.9 — 2021-07-11
- 2.8.8 — 2021-07-07
- 2.8.7 — 2021-06-01
- 2.8.6 — 2021-05-08
- 2.8.5 — 2021-04-26
- 2.8.4 — 2021-03-19
- 2.8.3 — 2021-02-01
- … 18 more at https://npm.io/package/@ahooksjs/use-request/versions

## README

# useRequest

Production-ready React Hook to manage asynchronous data.

**Core Characteristics**

* Auto-triggered request and Manually-triggered Request
* SWR(stale-while-revalidate)
* Cache / Preload
* Refresh On Window Focus
* Polling
* Debounce
* Throttle
* Concurrent Request
* Dependent Request
* Loading Delay
* Pagination
* Load more, data recovery and scroll position recovery
* ......

## Installing

Inside your React project directory, run the following:

yarn add @ahooksjs/use-request

```bash
yarn add @ahooksjs/use-request
```

Or with npm:

```bash
npm install @ahooksjs/use-request
```

## Example

```javascript
import useRequest from '@ahooksjs/use-request';

const { data, error, loading, run } = useRequest('/api/user');
```

## Documentation

https://ahooks.js.org/hooks/async

---
_Source: https://npm.io/package/@ahooksjs/use-request · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
