UNPKG

als-component

Version:

lightweight JavaScript library for creating reactive, server-rendered, and browser-based components.

15 lines (13 loc) 475 B
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))}">&times;</button> <span click="${this.action('click', () => todos.completed(id))}" ${completed ? 'style="text-decoration: line-through;"' : ''} >${name}</span> </div>` } }