Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Last active August 29, 2015 14:25
Show Gist options
  • Save yelouafi/fab88c36a0c36103db46 to your computer and use it in GitHub Desktop.
Save yelouafi/fab88c36a0c36103db46 to your computer and use it in GitHub Desktop.
// state : {likes: Number, dislikes: Number}
function likeView(state, handler) {
return h('div', [
h('button', {
on : { click: handler.bind(null, {action: 'like'}) }
}, 'Like'),
h('button', {
on : { click: handler.bind(null, {action: 'dislike'}) }
}, 'Dislike'),
h('div', `Likes : ${state.likes}`),
h('div', `Dislikes : ${state.dislikes}`),
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment