UNPKG

als-component

Version:

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

18 lines (15 loc) 556 B
const Component = require('../../component/component') 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>` } } module.exports = Todo