Mantra - react-router

Hello,

I found mantra very interesting but I didn’t succeed to make it work with react-router.
Did someone have an exemple about how to use mantra with react-router ?

Thanks !

Simply replace FlowRouter to RR here: https://github.com/mantrajs/mantra-sample-blog-app/blob/master/client/modules/core/routes.jsx#L12

You may need to change components a bit.

The problem seems to be react-router wants me to regroup all my routes in the same place eg:
render(( <Router history={browserHistory}> <Route path="/" component={App}> <Route path="login" component={Login}/> <Route path="users" component={Users}/> </Route> </Router> ), document.body)

I didn’t succeed in putting each route in each module.

Yes. You need to keep routes in a single module.
Use this pattern: https://kadirahq.github.io/mantra/#sec-Single-Core-Module

Thanks it’s working :slightly_smiling:

1 Like

In terms of route modularity and the Mantra style, would it be possible to do something similar to the huge-apps example for React-Router?

Example Here

2 Likes

Please consider reading my proposition here.