@ahooksjs/use-request
TypeScript icon, indicating that this package has built-in type declarations

2.8.15 • Public • Published

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

yarn add @ahooksjs/use-request

Or with npm:

npm install @ahooksjs/use-request

Example

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

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

Documentation

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

Readme

Keywords

none

Package Sidebar

Install

npm i @ahooksjs/use-request

Weekly Downloads

31,208

Version

2.8.15

License

MIT

Unpacked Size

129 kB

Total Files

68

Last publish

Collaborators

  • chenbin93
  • fan576679268
  • tli4
  • awmleer
  • monkindey