Here is a statefull component in Mithril without any hook...
const Counter = function () {
let count = 0;
const increment = () => count += 1;
const view = function () {
return [
m("h3", `Counter : ${count}`),
m("button", {onclick : increment}, "Inc me")
]
}
return { view }
}
m.mount(app, Counter)
You can test it here : Simple Counter
Top comments (0)