AsyncDataLoaderT
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
Arguments
oldData
— DataT | null — The previously loaded item, if any; or null.
Result
The data loader function must either return a Promise resolving to a DataT value, or just return a DataT value directly.