Store + Context
🛒 0 in cart
The badge reads the store via context — no prop drilling.
Usage
import { store, createContext, provide, useContext, html } from "./index.js"; // store() makes each key its own signal — mutate it like a plain object.const cart = store({ items: 0 });const CartCtx = createContext(null); const CartBadge = () => { const c = useContext(CartCtx); // read from anywhere below return html`<span>🛒 ${() => c.items} in cart</span>`;}; provide(CartCtx, cart, () => html` ${CartBadge()} <button onclick=${() => cart.items++}>Add to cart</button>`)