Skip to content

Instantly share code, notes, and snippets.

@egoist
Last active November 24, 2016 03:55
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 egoist/164f22a1689d3d31f699783274fa3046 to your computer and use it in GitHub Desktop.
Save egoist/164f22a1689d3d31f699783274fa3046 to your computer and use it in GitHub Desktop.
const counter = pen({
count: 0
})
.mutation('increment', ctx => {
ctx.state.count++
})
.render((h, ctx) => h('button', {
on: {
click: () => ctx.commit('increment')
}
}, ctx.state.count))
counter.mount('#counter')
counter.commit('increment')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment