Skip to main content

useAsyncEffect

The useAsyncEffect hook allows usage of an async function as the effect call back function. More Info...

import { useAsyncEffect } from '@archibald/client';

useAsyncEffect(PARAMETERS);

Parameters

NameTypeOptionalDescriptionDefault
actionAsyncFunction | AsyncOptionsA function that should be executed as effect callback or an object holding callback functions to be used in the hook.
depsany | any[]✔️Hook dependencies.An empty array.

action

An action can be a function or an object. More Info...

Passing a function as the action

AsyncFunction

Passing an object as the action

AsyncOptions

The AsyncOptions object has the following properties:

PropertyTypeDescription
effectAsyncFunctionAn async function that should be executed as effect callback.
destroyDestroyCallbackA function that should be executed in the cleanup callback.