UNPKG

@reatom/react

Version:
12 lines (11 loc) 873 B
import { Action, Atom, AtomState, Fn, Rec, Store } from '@reatom/core/'; import React from 'react'; export declare const reatomContext: React.Context<Store>; export declare const setBatchedUpdates: (f: (callback: () => any) => void) => void; export declare function useAction<Args extends any[] = []>(actionCreator: (...args: Args) => Action | Action[] | void, deps?: any[]): (...args: Args) => void; declare type ActionCreators<T extends Rec = {}> = { [K in keyof T]: T[K] extends (...a: infer Args) => Action ? (...args: Args) => void : never; }; export declare function useAtom<T extends Atom>(atom: T, deps?: any[]): [state: AtomState<T>, bindedActionCreators: ActionCreators<T>]; export declare function useAtom<T extends Atom, Res>(atom: T, map: Fn<[AtomState<T>], Res>, deps?: any[]): [state: Res, bindedActionCreators: ActionCreators<T>]; export {};