let youSaid = m.prop('');
const clearButton = {
view: (_, args) =>
m('button', { onclick: args.clickAction }, 'Clear')
}
const helloWorld = {
view: () => [
m('h1', 'Hello World'),
m(clearButton, { clickAction: () => youSaid('')}),
' ',
m('input', {
value: youSaid(),
oninput: e => youSaid(e.target.value)
}),
' You said: ' + youSaid(),
m('ul', youSaid().split('').map(c => m('li', c)))
]
}
m.mount(document.body, helloWorld);
Also see: Tab Triggers