JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgit.com/lhorie/mithril.js/next/mithril.js"></script>
JavaScript
var data = {
nextId: 0,
ids: []
}
var App = {
view: function(v) {
return [
m(`button`, {
'onclick': () => {
data.ids.push(data.nextId++)
}
},
`Add item`
),
m(`br`),
m(`svg`,
m("g", data.ids
.slice(-2)
.map(id => m(`circle`, {
"key": id,
'cx': 5 + 10 * id,
'cy': 5,
'r': 5,
})
))
)
]
}
}
m.mount(document.body, App)