Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Ho to comopose router #126

Closed
btomala opened this issue Mar 18, 2016 · 1 comment
Closed

Ho to comopose router #126

btomala opened this issue Mar 18, 2016 · 1 comment

Comments

@btomala
Copy link

btomala commented Mar 18, 2016

Hey, I look a round and I can't find way how to reuse my routes.

Suppose to I have two type of user in my app AdminUser and ComonUser. And must to create two routes.. when I build bundle common user don't need admin parts, is more secure and bundle is lighter.

So I have to Routers; Admin router:

        <Router history={history}>
           <Route component={CommonPage} path="/common">
                ....
            </Route>
            <Route component={AdminPage} path="/admin">
                ....
            </Route>
        </Router>

and Common Router:

        <Router history={history}>
            <Route component={CommonPage} path="/common">
                ....
            </Route>
        </Router>

Ho can I encapsulate Common routes in one Routes? And create some think like this:

        <Router history={history}>
           <CommonRoutes />
            <Route component={AdminPage} path="/admin">
                ....
            </Route>
        </Router>
@btomala
Copy link
Author

btomala commented Mar 18, 2016

I find the solution:
const commonRoutes = <Route component={CommonPage} path="/common"> ... </Route>

you can also put it to tutorial

@timdorr timdorr closed this as completed Mar 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants