aboutsummaryrefslogtreecommitdiffstats
path: root/root/meta/mmm.component/simple_counter/text$lua -> mmm$component.lua
blob: 6912f027cf81f1eef857a18772a5d1fcb6e8e843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local comp = require 'mmm.component'
local div, button = comp.elements.div, comp.elements.button

local count = comp.ReactiveVar(0)

return div {
  button {
    '-',
    onclick = function () count:set(count:get() - 1) end
  },
  " count is: ",
  count:map(comp.text),
  " ",
  button {
    '+',
    onclick = function () count:set(count:get() + 1) end
  },
}