Package Exports
- @ahooksjs/use-request
- @ahooksjs/use-request/lib/types
- @ahooksjs/use-request/package
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ahooksjs/use-request) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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
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');