Is there a way to react the router to modular routes and then just import them and collect them?
So instead:
<Router> <Route path="/" component={App}> <Route path="inbox" component={Inbox}> <Route path="messages/" component={AllMessages} /> <Route path="messages/:id" component={Message} /> </Route> <Route path="calendar" component={Calendar}> <Route path="year" component={Year}> <Route path="month" component={Month}> <Route path="week" component={Week}/> </Route> </Route> </Route> </Route> </Router>
You can do something like this:
let InboxRoutes = React.createClass({ render: function(){ return ( <Route path="inbox" component={Inbox}> <Route path="messages/" component={AllMessages} /> <Route path="messages/:id" component={Message} /> </Route> ); } }); <Router> <Route path="/" component={App}> <InboxRoutes/> <CalendarRoutes/> </Route> </Router>
I get: Warning: Location did not match any routes
source share