useRequest
useRequest is a hook that is designed to handle request state. It uses useReducer
under the hood and returns state and three actions to update it.
State
The return state has the following properties
- loading
- initialLoad
- succeeded
- error
- data
Actions
loading
- flips
loading
totrue
- flips
succeeded
tofalse
- resets
error
tonull
succeeded
- flips
loading
tofalse
- flips
succeeded
totrue
- flips
initialLoad
tofalse
- populates
data
with the given argument
failed
- flips
loading
tofalse
- flips
initialLoad
tofalse
- populates
error
with the given argument
fulfilled
- flips
loading
tofalse
- flips
initialLoad
tofalse