useAsync

Source
import { useAsync } from "@prestojs/util";
useAsync<ResultT,ErrorT = Error>(fn,?options)
Params:
ParameterTypeDescription
*fn
options
An object with the properties below
options.argsany[]
options.onError
options.onSuccess
options.trigger"MANUAL"|"DEEP"|"SHALLOW"
Returns:
An object with these properties:
PropertyTypeDescription
*errorErrorT|null
*isLoadingboolean
*reset
*responseResultT|null
Deprecated:
*resultResultT|null
*run