UNPKG

state-pool

Version:

Transform your React app with our state management library! Declare global and local states like variables, powered by the magic of React hooks 🪄✨

10 lines (9 loc) • 487 B
export type Unsubscribe = () => void; export type Reducer<ST, A> = (state: ST, action: A) => ST; export type Selector<ST> = (state: any) => ST; export type Patcher<ST> = (state: any, value: ST) => void; export type StateInitializer<T> = () => T; export type StateUpdater<ST> = (state: ST) => ST; export type StateModifier<ST> = (state: ST) => void; export type SetState<ST> = (newState: ST | StateUpdater<ST>) => void; export type UpdateState<ST> = (updater: StateModifier<ST>) => void;