UNPKG

siegel

Version:

Web application development ecosystem

12 lines (11 loc) 605 B
import type { StoreShouldUpdate, StateWithUpdater, ActionsUnbinded, ActionsBinded, HookStore } from './types'; declare function createStore<S extends Obj, A extends ActionsUnbinded<S>>(initialStateResolver: () => S, actions: A): { /** Store */ store: HookStore<S, A>; /** Hook that subscribes component to the store */ useStore(shouldUpdate?: StoreShouldUpdate<StateWithUpdater<S>>): readonly [StateWithUpdater<S>, ActionsBinded<A>]; /** Resets store to its default state */ reset(): void; }; export default createStore; export type { HookStore, ActionsBinded, StateWithUpdater };