Playground
// Try mx.js - edit this code and press Run (or Ctrl+Enter)
define('hello', {
$({ name = 'World', count = 0 }) {
return [
mx.h1('Hello, ' + name + '!'),
mx.p('You clicked ' + count + ' times.'),
mx.button({
onclick: _ => this.$({ count: count + 1 }),
style: 'padding:8px 20px;font-size:16px;cursor:pointer'
}, 'Click me')
];
}
});
document.body.render(mx('hello'));