UNPKG

mobx-store-provider

Version:
32 lines (31 loc) 1.35 kB
import { Provider } from "react"; import { IAnyModelType, Instance } from "mobx-state-tree"; /** * React Hook used to retrieve a store `Provider`. * @param model mobx-state-tree model * @param identifier The identifier used for the store (optional) * @returns The store Provider */ declare function useProvider<M extends IAnyModelType>(model: M, identifier?: any): Provider<Instance<M>>; /** * React Hook used to instantiate a new store from within a component. * @param model mobx-state-tree model * @param snapshot input snapshot used during creation (optional) * @returns The store instance */ declare function useCreateStore<M extends IAnyModelType>(model: M, snapshot?: any, env?: any): Instance<M>; /** * React Hook used to retrieve a store. * @param model mobx-state-tree model * @param identifier The identifier used for the store (optional) * @returns The store instance */ declare function useStore<M extends IAnyModelType>(model: M, identifier?: any): Instance<M>; /** * Method used to retrieve a store from outside a component. * @param model mobx-state-tree model * @param identifier The identifier used for the store (optional) * @returns The store instance */ declare function getStore<M extends IAnyModelType>(model: M, identifier?: any): Instance<M>; export { useProvider, useCreateStore, useStore, getStore };