Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Last active September 1, 2016 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markbrown4/85930c000b58a85da1fe66490154797e to your computer and use it in GitHub Desktop.
Save markbrown4/85930c000b58a85da1fe66490154797e to your computer and use it in GitHub Desktop.
const Todo = (props, send)=> {
const todo = props.todo;
const index = props.index;
return html`
<li>
<input
type="checkbox"
${todo.completed ? 'checked' : ''}
onchange=${(e)=> onChange(e, index)}
/>
${todo.title}
</li>
`;
function onChange(e, index) {
const updates = { completed: e.target.checked };
send('updateTodo', { index: index, updates: updates });
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment