als-component
Version:
lightweight JavaScript library for creating reactive, server-rendered, and browser-based components.
15 lines (13 loc) • 475 B
JavaScript
class Todo extends Component {
constructor(props, inner) {
super(props, inner)
}
render({ todo: { name, id, completed }, todos }) {
return /*html*/`<div>
<button click="${this.action('click', () => todos.remove(id))}">×</button>
<span click="${this.action('click', () => todos.completed(id))}"
${completed ? 'style="text-decoration: line-through;"' : ''}
>${name}</span>
</div>`
}
}