Using React-Router is there a way manage nested routes that overlay on top of the original route navigation?
I went through the react-router documentation but had trouble finding an example where the original navigation links were removed or hidden on the page.
I'm looking for an example like the below image:
I'm trying to have each tab in the above image be represented by a unique route, and then when a user clicks on an element under a tab, the element's detailed view would show overtop the entire page beneath the app's header. To me, a nested route seems to make sense in this scenario, however, the nested route puts the detailed component beneath the tabbed component. Which is not the user experience I'm looking for.
The routes that I believe make sense given the above would be something like:
Tabs:
/overview/tab1
/overview/tab2
/overview/tab3
Detailed View of Elements:
/overview/tab1/elements/:elementNumber
I was able to achieve this using the following:
export function Navigation() {
return (
<div>
<Switch>
<Route path="/tabs">
<TabbedNavigation />
</Route>
<Route path="/details">
<DetailedNavigation />
</Route>
</Switch>
</div>
);
}
export function TabbedNavigation() {
return (
<>
<Switch>
<Route path="/tabs/tab1">
<Tab1 />
</Route>
<Route path="/tabs/tab2">
<Tab2 />
</Route>
<Route path="/tabs/tab3">
<Tab3 />
</Route>
</Switch>
</>
);
}
export function DetailedNavigation() {
return (
<>
<Switch>
<Route path="/details/elements/:elementNumber">
<ElementDetails />
</Route>
</Switch>
</>
);
}
The above works fine, and provides the user experience I'm looking to achieve, but I feel like there has to be a better way to achieve the same using the react-router api.
Is it possible to have overplayed routes using react-router?

absoluteorfixedfor the CSSpositionof theDetailedNavigationcomponent and have amargin-topequal to your application header?