React - nested Link leads to wrong url

Viewed 39

I've problem with nested links in react. When i open my profile i'll get here: http://localhost:3000/profile There is a subnav. When i click on orders it shows me: http://localhost:3000/profile/adminorders Within orders there is still subnav and when i now go to show users i get this: http://localhost:3000/profile/adminorders/adminuserlist

but i need only: http://localhost:3000/profile/adminuserlist

thats lead always to redirect to my 404 page...

<Route path='/' exact element={<Main/>} />

<Route
 path='/profile'
 element={isLogged ? <Profile /> : <NotFound />}
 exact
/>

<Route
 path='/profile/adminorders'
 element={isAdmin ? <AdminOrders /> : <NotFound />}
 exact
/>

<Route
path='/profile/adminuserlist'
element={isAdmin ? <AdminUserList /> : <NotFound />}
exact
/>
0 Answers
Related