Mantra - react-router


#1

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 !


#2

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


#3

You may need to change components a bit.


#4

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.


#5

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


#6

Thanks it’s working :slightly_smiling:


#7

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


#8

Please consider reading my proposition here.