Skip to main content


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

The AsyncDataLoaderT type is the signature of a valid data loader function for the useAsyncData() hook.

It is defined as a generic type:

export type AsyncDataLoaderT<DataT>
= (oldData: null | DataT) => DataT | Promise<DataT>;

Generic Parameters

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


  • oldDataDataT | null — The previously loaded item, if any; or null.


The data loader function must either return a Promise resolving to a DataT value, or just return a DataT value directly.