Created
June 26, 2016 00:06
-
-
Save timwis/ecf6fe13ccb51fb1fd093b854be78a45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is this the same lib that we used put