This hook allows a safe execution of an async callback within an imperative funcion.
This hook provides a way to call any async function without the need to handle race conditions or memory leak problems.
The state change due to errors response must be done within onError
param. Any other successful result can safely change states withing
onSuccess
.
It is possible to add an error handler context in a component tree using the
ErrorHandlerProvider. The onError
param has precedence over
the error handler in the context.
Generated using TypeDoc
The following function was based on @istarkov code