Skip to main content

AsyncCollectionReloaderT

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

The AsyncCollectionReloaderT type is the signature of data re-loader function in the result of useAsyncCollection() hook (see reload in UseAsyncCollectionResT). It is defined as generic type

export type AsyncCollectionReloaderT<
DataT,
IdT extends number | string = number | string,
> = (loader?: AsyncCollectionLoaderT<DataT, IdT>) => void | Promise<void>;

Generic Parameters

  • DataT — the type of data loaded by the function.
  • IdT — the type of collection keys.

Arguments

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).