Control flow · when

👀 Now you see me — toggled by a signal.

Usage

import { signal, html, when } from "./index.js";

const show = signal(true);

// when(cond, then, else?) swaps branches as the signal flips —
// each branch's effects are created on enter and disposed on exit.
when(show,
  () => html`<p>👀 Now you see me.</p>`,
  () => html`<p>…hidden.</p>`,
)