Skip to main content

AsyncCollectionT

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

The AsyncCollectionT type describes a segment of the global state managed by an useAsyncCollection() hook — a map between string/number IDs and corresponding data, wrapped into auxiliary envelopes:

type AsyncCollectionT<
DataT = unknown,
IdT extends number | string = number | string,
> = { [id in IdT]?: AsyncDataEnvelopeT<DataT> };

Generic Parameters

  • DataT — The type of collection items, defaults uknown.
  • IdTnumber | string — The type of collection keys (IDs), defaults number | string.