Skip to main content

AsyncDataReloaderT

import type { AsyncDataReloaderT } from '@dr.pogodin/react-global-state';

The AsyncDataReloaderT type is the signature of data re-loader function in the result of useAsyncData() hook (see reload in UseAsyncDataResT). It is defined as generic type

export type AsyncDataReloaderT<DataT>
= (loader?: AsyncDataLoaderT<DataT>) => void | Promise<void>;

Generic Parameters

  • DataT — the type of data loaded by the function.

Arguments

  • loaderAsyncDataLoaderT<DataT> | undefined — Optional. The loader function to use; when not provided the loader given to the corresponding useAsyncData() hook is used.

Result

If the reload happens synchronously it returns right away; otherwise it returns a promise which resolves once the reload is completed (or aborted, either failed).