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

139
Views
Render multiple elements in React Router v6.+

I need the answer to this question: Render multiple components in React Router but for the newer version of react-router-dom (I'm using v6.0.2)

the older version of router-dom would work like this:

<Route path="/">
 <Header/>
 <Home/>
</Route>

while the new one looks like this:

<Route exact path="/" element={<Home/>}/>

I'm not sure how to add the Header as well

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

0

Try wrap them in a fragment

<Route exact path="/" element={<><Header/><Home/></>}/>
about 4 years ago · Juan Pablo Isaza Report

0

I ran in to the same issue, but also needed one page to get data from the parent element.

<Route path="/" element={<><Header/><Home children={<HomeDataProvider/>}/></>} />
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!