Created
September 1, 2016 21:34
-
-
Save markbrown4/31836333e9ac1a6d256abaf860cc010b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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