Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
React router nesting routes inside route

I have a problem with nesting routes inside route. User component has tabs and I want to display components based on URLs like this /profile/:userid/about and /profile/:userid/posts and /profile/:userid.

<Routes>
   <Route path="/" element={<HomePage/>}/>
   <Route path="profile/:username/*" element={<ProfilePage/>}/>
   <Route path="login" element={<Login/>}/>
   <Route path="register" element={<Register/>}/>
</Routes>

Profile routes

<ProfileContentWrapper className='rightPanel'>
    <PorfileTabs/>
    <Routes>
        <Route path='/about' render={() => <ProfileAbout/>}/>
        <Route path='/posts' render={() => <ProfilePosts/>}/>
    </Routes>
</ProfileContentWrapper>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You need to use the full path in ProfileContentWrapper as well.

<Route path='profile/:username/about' render={() => <ProfileAbout/>}/>
<Route path='profile/:username/posts' render={() => <ProfilePosts/>}/>
about 4 years ago · Juan Pablo Isaza Report

0

Ok. I have found a problem in react-router v6 useRouteMatch is replaced with useMatch. In v6 I need to pass the route pattern to useMacht("profile/:username/")

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!