UNPKG

react-principal

Version:

A state management with react context for apps which using hooks.

25 lines 807 B
/// <reference types="react" /> import { Reducer } from "./types"; export interface Store<S> { useState(nextObserveState?: (keyof S)[]): S; useDispatch(): (action: any) => void; } export interface PrivateStore<S> { useState(nextObserveState?: (keyof S)[]): S; useDispatch(): (action: any) => void; stateContext: React.Context<S>; dispatchContext: React.Context<(action: any) => void>; reducer: Reducer<S>; initialState: S; } /** * This function give you an store, use that in your components which want to * connect to store and provider */ export declare const createStore: <T extends { [x: string]: any; }>({ reducer, initialState, }: { reducer: Reducer<T, import("./types").Action>; initialState: T; }) => Store<T>; //# sourceMappingURL=createStore.d.ts.map