Im creating a Dashboard page, where I always want to show a Sidebar Component if the route path is /dashboard. But I also want /dashboard to render another component aswell.
What I am trying to achieve:
- Route path: /dashboard should render the
Sidebar.js+Overview.jscomponents. - Route path: /dashboard/account should render
Sidebar.js+Account.jscomponents. - Route path: /dashboard/favorites should render
Sidebar.js+Favorites.jscomponents. - And so on...
Can someone point me in the right direction how to achieve this? Cant get my head around it...
See below to get a more feeling of how I want it:
This is what I tried so far:
<Route path="/" exact component={Home} />
<Route path="/podcast/:podId/:podName" component={Podcast} />
<Route exact path="/categori/:categoryName" component={Category} />
<AuthRoute path="/login" component={Login} />
<AuthRoute path="/signup" component={Signup} />
</Switch>
<Route
path="/dashboard"
render={({ match: { url } }) => (
<>
<Route path={`${url}/`} component={Sidebar} />
<Route path={`${url}/`} component={Overview} />
<Route path={`${url}/favorites`} component={Favorites} />
</>
)}
/>```

