Reputation: 655
Hello how can i render routes which are actually separated on different component for example my Dashboard has 2 routes with 2 components inside and my App.js is having all the rest. and also i'm having trouble to redirect to the /login from inside dashboard it doesn't redirect (i used history.push("/login")) from inside dashbord
UPDATE :
my code looks like that dashboard.js component
<Router>
....mycomponent
<switch>
<Route path="/cutomers"><CutomersComponent><Route>
<Route path="/sales"><SalesComponent><Route>
</switch>
</Router>
app.js component
<Router>
....mycomponent
<switch>
<Route path="/login"><Login><Route>
<Route path="/dashbord"><Dashbord><Route>
</switch>
</Router>
Upvotes: 0
Views: 142
Reputation: 655
solution was simply by migrating from react router v5 to react router v6 here's a github repo which i made with explanation
https://github.com/w4t3r-45/react-router-v6
Upvotes: 1