Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda