useRequest
This Hook is available since v1.4.0.
This Hook is marked asdeprecatedsincev1.5.0.
A hook that helps you manage the request status, including loading, refreshing, initializing, error, etc.
A deprecated version of useQuery
, please use useQuery instead.
Demo
SourceImmediate + Trigger by user + Dependencies
Lifecycle + Refresh + Params + Mutate + Cancel
Throttle + Debounce
Data with debounce: Not loaded
Data with throttle: Not loaded
ReFocus + ReConnect + AutoRefresh + Loading Slow
Error Retry + Cache (SWR)
Usage
See API for more details.
Source
Click links below to view source on GitHub.
API
const {
run, data, loading, refreshing, initializing, error,
cancel, refresh, mutate, loadingSlow, ...pausable
} = useRequest(fetcher, options)
See useQuery for more details.