wasmoon // pages/counter.lua
data-lua-module="pages/counter"
source
local h = require("h").h
local reactive = require("reactive")
local count, setCount = reactive.signal(0)
local root = h("div", {},
h("h2", {}, "Counter"),
h("p", {}, function()
return "Count: " .. count()
end),
h("button", {
onClick = function() setCount(count()-1) end,
}, "-"),
h("button", {
onClick = function() setCount(count()+1) end,
}, "+")
)
dom.mount(root, "#app")
One signal, two handlers. The text node closure re-runs whenever count changes — no virtual DOM diff.