little-state-machine
Version:
State management made super simple
11 lines (10 loc) • 554 B
TypeScript
import { StateMachineOptions, GlobalState, AnyCallback, AnyActions, ActionsOutput } from './types';
export declare function createStore(defaultState: GlobalState, options?: StateMachineOptions): void;
export declare function useStateMachine<TCallback extends AnyCallback, TActions extends AnyActions<TCallback>, TStore>({ actions, selector, }?: {
actions?: TActions;
selector?: ((payload: TStore) => TStore) | undefined;
}): {
actions: ActionsOutput<TCallback, TActions>;
state: GlobalState;
getState: () => GlobalState;
};