Skip to content

preact

import {
  useStore
} from "exome/preact";

function useStore

Subscribes to store instance update events and trigger updates to component accordingly.

function useStore<T extends Exome>(store: T): Readonly<T>;
example.tsx
import { useStore } from "exome/preact"
import { counterStore } from "./counter.store.ts"
 
function App() {
  const { count, increment } = useStore(counterStore)
 
  return (
    <button onClick={increment}>{count}</button>
  );
}