Nested Routes not rendering for <CompatRoute> #8997
Replies: 4 comments
-
|
Fixed the issue by upgrading the AdminRouter to v6 Routes and Route, along with relative paths |
Beta Was this translation helpful? Give feedback.
-
|
I resolved this problem by doing this: #8907 |
Beta Was this translation helpful? Give feedback.
-
|
My question is a little different. The first layer of CompatRoute can be rendered but the second layer CompatRoute can't be rendered. Not resolved yet. |
Beta Was this translation helpful? Give feedback.
-
|
To help anyone facing the same issue, I’d like to share what worked and what didn’t work for me. If you’ve arrived here, you probably have a
For anyone that wants to reasearch more, these are related issue talking about Now lets dive into the solution I found and that worked is here. Here are some considerations from my testing:
Some points noted, while |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I am working on upgrading from react-router v5 to v6 by following the migration guide. In my app, I have quite a few nested switch components. After switching the Routes to CompatRoutes, the switch does not render anything. Any suggestions of how to work around this?
Root switch:
<Switch> <CompatRoute path="/administration" component={AdministrationDashboard} /> </Switch>(I have tried setting the path to "/administration/*" to no avail)
AdministrationDashboard:
<> { /* ...some components */} <AdminRouter /> </>AdminRouter:
<Switch> <CompatRoute path="/administration/general" component={AdminGeneral} /> <CompatRoute path="/administration/settings" component={AdminSettings} /> <CompatRoute path="/administration/help" component={AdminHelp} /> </Switch>When the route pathname is "/administration/general", for example, the other components in AdministrationDashboard render, but none of the Routes in the AdminRouter are returned.
Any help is much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions