// ssr-counter/Counter.el // // A counter component that demonstrates: // - State with initial value // - {#if} conditional rendering // - {#each} list rendering // - Interpolation // - Event binding // - SSR + client hydration // // Run `node render.js Counter` to see the server-rendered HTML. // Open index.html in a browser to see the full SSR + hydration lifecycle. component Counter { props { initialValue: Int = 0 label: String = "Counter" } state { count: Int = 0 history: String = "" } fn increment() -> Void { count = count + 1 history = history + "+" + count + " " } fn decrement() -> Void { count = count - 1 history = history + "-" + count + " " } fn reset() -> Void { count = 0 history = "" } template {
{history}
Press + or - to begin.
{/if}Server-rendered, client-hydrated with spreading activation