I am trying to upgrade react router package from version 5 to 6. I have replaced Switch
to Routes
as below:
<Switch>
<Route path="/editor"> // takes to the editor route
{Some component}
</Route>
<ComponentA />
</Switch>
This ComponentA
used to have another Switch
which had more Route
components defined, but now it doesn't allow to have Routes
under Routes
(previously Switch
under a Switch
was allowed), nor does it allow to have Fragment
s.
ComponentA
looks like below:
<Switch>
<Route path="/abc"></Route>
<Route path="/xyz"></Route>
</Switch>
How can we define a component having more than one Route
inside Routes
?