UNPKG

exome

Version:

State manager for deeply nested states

23 lines (22 loc) 550 B
/** * @module exome/react */ import { type Exome } from "exome"; /** * Subscribes to store instance update events and trigger updates to component accordingly. * * @example: * ```ts * import { useStore } from "exome/react" * import { counterStore } from "./counter.store.ts" * * function App() { * const { count, increment } = useStore(counterStore) * * return ( * <button onClick={increment}>{count}</button> * ); * } * ``` */ export declare const useStore: <T extends Exome | null | undefined>(store: T) => Readonly<T>;