Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const choo = require('choo')
const html = choo.view
const onload = require('on-load')
const app = choo()
const page1 = (params, state, send) => {
const tree = html`
<div>
<h1>Page 1</h1>
<a href="/page2">Page 2</a>
</div>`
onload(tree, () => console.log('page1 loaded'))
return tree
}
const page2 = (params, state, send) => {
const tree = html`
<div>
<h1>Page 2</h1>
<a href="/">Page 1</a>
</div>`
onload(tree, () => console.log('page2 loaded'))
return tree
}
app.router((route) => [
route('/', page1),
route('/page2', page2)
])
const tree = app.start()
document.body.appendChild(tree)
@crapthings

This comment has been minimized.

Copy link

commented Jul 16, 2016

is this the same lib that we used put

with choo ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.