0

Question about routing, i want to have this structure:

/admin/:userId/settings/:settingId

How to setup router for this case? I tried this:

<Route exact path="/admin/:userId">
                user
                <Route exact path="/settings/:settingId">
                    setting
                </Route>
            </Route>
Marty
  • 534
  • 8
  • 24

2 Answers2

1

you can use in this situation the link look

<Link exact path="/admin/:userId"><a>useer<a><Link/>
<Link exact path="/settings/:settingId"><a>Setting<a><Link/>

you should add this in the router as this

<Route exact path="/admin/:userId" component={userId} />
<Route exact path="/admin/:userId/settings/:settingId" component= {settingsId} />
Mohammed Al-Reai
  • 2,344
  • 14
  • 18
0

Like this

Each part you render other component.

<Route exact path="/admin" component={admin} />
<Route exact path="/admin/:userId" component={userId} />
<Route exact path="/admin/:userId/settings" component={settings} />
<Route exact path="/admin/:userId/settings/:settingId" component= {settingsId} />

And you also can each route inside his father component.

Omer
  • 3,232
  • 1
  • 19
  • 19