Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda