Skip to content

Error Retry ​

By setting options.retryCount, set the number of error retries, useRequest will retry after it fails.

Code demonstration ​

API ​

Options ​

PropertyDescriptionTypeDefault
retryCountThe number of retries. If set to -1, it will try again indefinitely.number-
retryInterval
  • Retry interval in milliseconds.
  • If not set, the simple exponential backoff algorithm will be used by default, taking 1000 * 2 ** retryCount, that is, waiting for 2s for the first retry, and 4s for the second retry. By analogy, if it is greater than 30s, take 30s
number-

Remark

  • cancel can cancel the ongoing retry behavior.

Source ​

Source · Document · Demo

Released under the MIT License.