UNPKG

react-unistore

Version:

778b connector between React and unistore

20 lines (19 loc) 1.7 kB
/// <reference types="react" /> import { Action, StateMapper, Store } from "unistore"; export declare function mapActions(actions: Action<any>[] | ((store: Store<any>) => Action<any>[]), store: Store<any>): Record<any, any>; export declare function select(properties: string | string[]): (state: any) => Record<any, any>; export declare const Provider: import("react").ProviderExoticComponent<import("react").ProviderProps<Store<any>>>; export declare const useStore: () => Store<any>; export declare type UseAction = <State, Args extends any[]>(action: (state: State, ...args: Args) => Promise<Partial<State>> | Partial<State> | void) => (...args: Args) => void; export declare type TypedUseAction<State> = <Args extends any[]>(action: (state: State, ...args: Args) => Promise<Partial<State>> | Partial<State> | void) => (...args: Args) => void; export declare const useAction: <State, Args extends any[]>(action: (state: State, ...args: Args) => void | Partial<State> | Promise<Partial<State>>) => (...args: Args) => void; export declare type UseSelector<State, Selected> = (selector: (state: State) => Selected) => Selected; export declare type TypedUseSelector<State> = <Selected>(selector: (state: State) => Selected) => Selected; declare type EqualityFn = (a: any, b: any) => any; export declare const useSelector: <State, Selected>(selector: (state: State) => Selected, equalityFn?: EqualityFn) => Selected; export declare function connect<State, Props, Selected>(mapStateToProps?: StateMapper<Props, State, Selected>, actions?: Action<State>[]): (Child: any) => { (props: Props, context: any): void; contextType: import("react").Context<Store<any>>; prototype: any; }; export {};