import { h, q, frag, bootstrap, Rung, Capsule } from "./index"; import {SubNode} from "./lib/helpers"; const MyCoolDiv = (props: { isRed: boolean }, subNodes?: SubNode[]) => h("div", { classes: props.isRed ? ["red"] : [] }, ...subNodes ?? []); class App extends Rung { private counter = Capsule.new(0); private rungs = Capsule.new(null); constructor() { super({}); this.counter.watch((count) => { if (this.rungs.val) { this.rungs.val.replaceChildren( ...new Array(count).fill(null).map((_, i) => { return
; }) ); } }); } build() { return <>

Ladder

{this.counter}
; } } const app = new App(); bootstrap(app, "app");