Skip to main content

useAsyncActions

info

useAsyncActions is available since version 1.4.0

The useAsyncActions hook is used to retrieve asynchronous actions of a signal that has been recorded in the store.

It takes the name of the signal as a the first parameter and returns an object that contains all the asynchronous actions of this signal.

const { fetchMovies, createMovie } = useAsyncActions("movies");

Also, the useAsyncActions hooks accepts a series of asynchronous actions that you want to retrieve and it will return you an object that contain asynchronous actions that you asked for.

const { fetchMovies, createMovie } = useAsyncActions(
"movies",
"fetchMovies",
"createMovie"
);

Structure

  • useAsyncActions
PropertiesTypeStatusDescription
namestringrequiredThe name of the signal. It must be unique.
...actionsstring[]optionalThe series of asynchronous actions