Skip to content

Instantly share code, notes, and snippets.

@sethvincent
Created Sep 18, 2016
Embed
What would you like to do?
var choo = require('choo')
var html = require('choo/html')
var app = choo()
app.router(function (route) {
return [
route('/', home)
route('/:page', page)
]
})
app.start()
function home (state, prev, send) {
return html`<h1>home</h1>`
}
function page (state, prev, send) {
var pagename = state.params.page
// can also access state.location.pathname which mirrors window.location.pathname
return html`<h1>${pagename}</h1>`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment