Skip to content

Instantly share code, notes, and snippets.

@timwis
Created June 26, 2016 00:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timwis/ecf6fe13ccb51fb1fd093b854be78a45 to your computer and use it in GitHub Desktop.
Save timwis/ecf6fe13ccb51fb1fd093b854be78a45 to your computer and use it in GitHub Desktop.
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
Copy link

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