Nested Routes not rendering for <CompatRoute> #8997
Unanswered
laabroms
asked this question in
v5 to v6 Migration
Replies: 3 comments
-
Fixed the issue by upgrading the AdminRouter to v6 Routes and Route, along with relative paths |
Beta Was this translation helpful? Give feedback.
0 replies
-
I resolved this problem by doing this: #8907 |
Beta Was this translation helpful? Give feedback.
0 replies
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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