Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two different use examples #40

Open
SilentCicero opened this issue Aug 17, 2016 · 5 comments
Open

two different use examples #40

SilentCicero opened this issue Aug 17, 2016 · 5 comments

Comments

@SilentCicero
Copy link

SilentCicero commented Aug 17, 2016

// default to `/404` if no path matches
const router = sheetRouter('/404', [
  ['/', (params) => html`<div>Welcome to router land!</div>`],
  ['/:username', (params) => html`<div>${params.username}</div>`, [
    ['/orgs', (params) => html`<div>${params.username}'s orgs!</div>`]
  ]],
  ['/404', (params) => html`<div>Oh no, path not found!</div>`],
])
// default to `/404` if no path matches 
const router = sheetRouter('/404', function (route) {
  return [
    route('/', (params) => yo`<div>Welcome to router land!</div>`),
    route('/:username', (params) => yo`<div>${params.username}</div>`, [
      route('/orgs', (params) => yo`<div>${params.username}'s orgs!</div>`)
    ]),
    route('/404', (params) => yo`<div>Oh no, path not found!</div>`),
  ]
})

Am I using functions or not? Which example is most up to date?

@SilentCicero
Copy link
Author

love the router though, god bless.

@yoshuawuyts
Copy link
Owner

Ohey, yeah so yo-yo is using bel under the hood. I like assigning bel to html, just like I like assigning sheetify to css. E.g.

const css = require('sheetify')
const html = require('bel')

Which is quite the same as:

const css = require('sheetify')
const html = require('yo-yo')

Does this answer your question?

@SilentCicero
Copy link
Author

One example uses function (route) { and the other just arrays. That was my question. Apologies

@SilentCicero
Copy link
Author

@yoshuawuyts what is the latest sheet-router build?

@yoshuawuyts
Copy link
Owner

@SilentCicero v4 is super close now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants