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

141
Views
react router dom display nothing blank page showing up

If I remove the react router DOM, I can see the header component output. But if I add the router, I can't see anything, the page is blank, even no errors or warnings. I tried every possible way, but it didn't work. How to solve this?

My code parts:

import React from 'react';
import {BrowserRouter as Router, Routes, Route} from "react-router-dom";
<Header />
    
{/* <section className='mt-24 p-8 w-full'> */}
<Router>
    <Routes>
        <Route path="/" element={<MainContainer />} />
        <Route path="/createItem" element={<CreateItems/> } />
    </Routes>
</Router>

{/* </section> */}
</main>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If you're using React Router v6, this setup should work, try to verify if your components MainContainer and CreateItems are valid and make sure that they are imported as well

about 4 years ago · Juan Pablo Isaza Report

0

Try wrapping all your <Route /> components inside of a <Switch></Switch> instead of <Routes></Routes>. That should resolve the problem.

Also, I think you are using an older version of the react router so you can try upgrading to v6 as well and you will not need to wrap your routes in a <Switch></Switch> component either. https://reactrouter.com/docs/en/v6/upgrading/v5

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!