Choo: Rendering without app.router()

Created on 20 Jun 2016  路  3Comments  路  Source: choojs/choo

Application Stuff

First of all, I really appreciate this idea and movement for a slimmer, faster JS; really impressed with the roots that you have laid out here. I have a question (I am not assuming that I am correct here, that's up to you), does a router need to be required? I understand that the goal is to create a really small, powerful framework, but I believe I am experiencing a small issue because of the router. I am implementing <a href="#some-thing"> in my application using electron, and I believe the router may be confusing events when the anchor tag is clicked and the router re-renders the entire page.

export default (params, state, send) => choo.view`
<div class="wrapper">
  ${sidebar(params, state, send)}
  ${simulator(params, state, send)}
</div>
`;
const app = choo();
app.router((route) => [
  route('/', require('./src/components/main'))
]);
document.addEventListener('DOMContentLoaded', () => {
  document.body.appendChild(tree);
});

Most helpful comment

FYI I have choo working in electron with hash routing here if that helps.

All 3 comments

@wenkesj hey yeah, a router is required. If you'd like to create elements without a router consider using bel and appending the result to the DOM as usual.

If you want to disable routing, try running app.start({ href: false }). If you want to enable hash routing instead try running app.start({ hash: true }).

I hope this gets you on the right path; if not I'd be happy to dig in further if you can provide me with a repro. Cheers!

@yoshuawuyts Okay, cool. Makes sense, thanks

FYI I have choo working in electron with hash routing here if that helps.

Was this page helpful?
0 / 5 - 0 ratings