acdlite / redux-router

Redux bindings for React Router – keep your router state inside your Redux store
MIT License
2.3k stars 200 forks source link

[question] Possible for multiple providers to organize routing per component? #238

Closed davidck closed 8 years ago

davidck commented 8 years ago

Sorry for posting a question here...

Following the examples, I got redux-router working in my app. However, we found that at some point, centralizing all routes into one place isn't ideal. Is there a way to include multiple routers per app? For example, if I have a route to /client. I want to isolate all child routes inside of /client, such as /client/list, /client/add, etc...

Similar to this, basically allowing you to attach another router inside your component. https://github.com/STRML/react-router-component

Currently, I've attempted to include another provider+router within a component. Although it doesn't produce errors, it ignores all routing except for the root.

davidck commented 8 years ago

I just stumbled on the dynamic routing features. Maybe this will be a solution.

Scarysize commented 8 years ago

Yep, dynamic routing! Also you can split up your routes on a file-basis pretty easily, if you declare them without JSX. See: https://github.com/rackt/react-router/blob/latest/docs/guides/basics/RouteConfiguration.md#alternate-configuration

mjrussell commented 8 years ago

You can actually keep the JSX in separate files as well. Just use the following syntax:

import otherRoutes from './otherRoutes'

<Route path='/'>
  {otherRoutes}
</Route>
davidck commented 8 years ago

Thanks! Will take a look at it.