Inferno: What is the recommended way to handle routing in inferno?

Created on 7 Jun 2016  Â·  5Comments  Â·  Source: infernojs/inferno

Is there some equivalent to react-router? Or would it be possible to actually use react-router with inferno?

question

Most helpful comment

I have been using Navigo ( https://github.com/krasimir/navigo ), Its really simple and has no dependencies. It supports hashtag routing and html5 historyapi. You just register routes and callback functions into it.

Then in callback you just need to call InfernoDOM.render(something) depending on your app.

Also if you are building Single Page Application, its quite trivial to implement "Link" component that uses Navigos navigate function and prevents default to avoid page refresh.

All 5 comments

@billsykes there are plans to include an inferno-router at some point – I might even quickly get a working version up in the coming days. Long term, the plan is to also have routers for MobX, Cerebral and Redux equivalents.

in the mean time, someone in the Inferno community may have already made an inferno-router for a project they are working on, I can ask around for you :)

@trueadm thanks that would much appreciated!

I have been using Navigo ( https://github.com/krasimir/navigo ), Its really simple and has no dependencies. It supports hashtag routing and html5 historyapi. You just register routes and callback functions into it.

Then in callback you just need to call InfernoDOM.render(something) depending on your app.

Also if you are building Single Page Application, its quite trivial to implement "Link" component that uses Navigos navigate function and prevents default to avoid page refresh.

This is being covered with inferno-router https://github.com/trueadm/inferno/issues/239

Closing as the other thread is a better indicator for this topic.

Was this page helpful?
0 / 5 - 0 ratings