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