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

100
Visualizações
Reactjs screen is not rendering

I think that the problem is in the switch, in version of react-router-dom or in routes. Only when I created and applied the code in this class, the screen started don't render and stays white. I already changed the version of react-router-dom but I don't know what can be. Below the code of routes.js:

//react-router-dom version: "^5.3.0"
import {BrowserRouter, Route, Switch} from 'react-router-dom';
import Home from './pages/Home';
import Header from './components/Header';

const Routes = () => {
    return(
        <BrowserRouter>
            <Header/>
            <Switch>
                <Route exact path="/" component={Home}/>
            </Switch>
        </BrowserRouter>
    )
}

export default Routes;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

React Router v6 introduces some changes like.

Routes component that is kind of like Switch, but a lot more powerful one.

Route still exist but you don't pass a pointer to that component function or as a children component, Instead you pass the JSX element to the element prop & exact doesn't exist anymore, now it's always looks for exact matches.

So, component={Home} would become element={<Home />}

Something like this

<Routes>
    <Route path="/" element={<Home />} />
    <Route path="about" element={<About />} />
</Routes> 

You can dive deep to this migration guide: https://reactrouter.com/docs/en/v6/upgrading/v5

hope that's help you

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