Issue
I have template: SANDBOX
Why, when switching to a nested route, a double render occurs and thus the DRAWER is reopened. How to fix it? This effect u can watch inside "NEASTED" tab.
It is necessary that the first nested route opens by default.
Solution
It seems you have duplicate "drawer" routes. Remove the duplicate routes that are trying to redirect into the drawer, this allows the "/drawer"
route to keep the Drawer
component mounted. Use an index route in "/drawer"
to redirect to "/drawer/general"
.
function App() {
return (
<div className="App">
<Routes>
<Route path="/" element={<Base />} />
<Route path="drawer" element={<Drawer />}>
<Route path="general" element={<General />} />
<Route path="neasted" element={<NeastedTab />}>
<Route path="general_2" element={<General_2 />} />
</Route>
<Route index element={<Navigate to="./general" />} />
</Route>
</Routes>
</div>
);
}
Answered By - Drew Reese
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.