useRequest
Ready
The API useRequest
Ready
By setting options.ready, you can control whether a request is sent. When its value is false, the request will never be sent.
The specific behavior is as follows:
- In the automatic mode of
manual=false, every timereadychanges fromfalsetotrue, a request will be automatically executed with the parameteroptions.defaultParams. - When
manual=truemanual request mode, as long asready=false, the request triggered byrun/runAsyncwill not be executed.
Automatic mode
The following example demonstrates the behavior of ready in automatic mode. Every time ready changes from false to true, the request will be executed.
Manual mode
The following example demonstrates the behavior of ready in manual mode. Only when ready is equal to true, run will be executed.
API
Options
| Property | Description | Type | Default |
|---|---|---|---|
| ready | Is the current request ready | boolean | true |