piral-core
Version:
The core library for creating a Piral instance.
20 lines (19 loc) • 764 B
TypeScript
import { GlobalState } from '../types';
/**
* Hook to obtain the global state context, which gives you directly
* all actions, state, and more of the Piral instance.
* If you are only interested in reading out the state, use the
* `useGlobalState` hook instead.
*/
export declare function useGlobalStateContext(): import("../types").GlobalStateContext;
/**
* Hook that yields the full global state.
* Any change to the global state yields the new state.
*/
export declare function useGlobalState(): GlobalState;
/**
* Hook that yields the selected subset of the global state.
* Only changes to this subset will yield a new state.
* @param select The subset selection.
*/
export declare function useGlobalState<R>(select: (state: GlobalState) => R): R;