@dr.pogodin/react-global-state
Version:
Hook-based global state for React
24 lines (23 loc) • 2.03 kB
TypeScript
import GlobalState from './GlobalState';
import GlobalStateProvider, { useGlobalStateObject, useSsrContext } from './GlobalStateProvider';
import SsrContext from './SsrContext';
import useAsyncCollection, { type UseAsyncCollectionI, type UseAsyncCollectionResT } from './useAsyncCollection';
import { type AsyncDataEnvelopeT, type AsyncDataLoaderT, type AsyncDataReloaderT, type LoadAsyncDataI, type UseAsyncDataI, type UseAsyncDataOptionsT, type UseAsyncDataResT, loadAsyncData, newAsyncDataEnvelope, useAsyncData } from './useAsyncData';
import useGlobalState, { type UseGlobalStateI } from './useGlobalState';
export type { AsyncCollectionLoaderT, AsyncCollectionReloaderT, AsyncCollectionT, } from './useAsyncCollection';
export type { SetterT, UseGlobalStateResT } from './useGlobalState';
export type { ForceT, ValueOrInitializerT } from './utils';
export { type AsyncDataEnvelopeT, type AsyncDataLoaderT, type AsyncDataReloaderT, GlobalState, GlobalStateProvider, SsrContext, type UseAsyncCollectionI, type UseAsyncCollectionResT, type UseAsyncDataI, type UseAsyncDataOptionsT, type UseAsyncDataResT, type UseGlobalStateI, loadAsyncData, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, useGlobalStateObject, useSsrContext, };
interface API<StateT, SsrContextT extends SsrContext<StateT> = SsrContext<StateT>> {
GlobalState: typeof GlobalState<StateT, SsrContextT>;
GlobalStateProvider: typeof GlobalStateProvider<StateT, SsrContextT>;
SsrContext: typeof SsrContext<StateT>;
loadAsyncData: LoadAsyncDataI<StateT>;
newAsyncDataEnvelope: typeof newAsyncDataEnvelope;
useAsyncCollection: UseAsyncCollectionI<StateT>;
useAsyncData: UseAsyncDataI<StateT>;
useGlobalState: UseGlobalStateI<StateT>;
useGlobalStateObject: typeof useGlobalStateObject<StateT, SsrContextT>;
useSsrContext: typeof useSsrContext<SsrContextT>;
}
export declare function withGlobalStateType<StateT, SsrContextT extends SsrContext<StateT> = SsrContext<StateT>>(): API<StateT, SsrContextT>;