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

168
Visualizações
showing white screen when put content in <Route> tag in react

the code showing white screen , even not showing header and footer . but when I remove a code in route tag , it shaw header and footer .

<><BrowserRouter>

  <Header title="My Todos List" searchBar={false} />
  <Routes>
    <Route exact path="/" render={() => {
      return (
        <>
          <Addtodo addTodo={addTodo} />
          <Todos todos={todos} onDelete={onDelete} />
        </>)
    }}>
    </Route>
    <Route exact path="/about">
      <About />
    </Route>
  </Routes>
  <Footer />

</BrowserRouter>
</>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It seems you are mixing up the react-router-dom v5 Route API while using v6. The Route component doesn't take a component or render props, and only other Route components can be a child of a Route. They now take only an element prop that takes a ReactElement, a.k.a. JSX. Also gone is the exact prop. In RRDv6 routes are now always exactly matched.

<BrowserRouter>
  <Header title="My Todos List" searchBar={false} />
  <Routes>
    <Route
      path="/"
      element={(
        <>
          <Addtodo addTodo={addTodo} />
          <Todos todos={todos} onDelete={onDelete} />
        </>
      )}
    />
    <Route path="/about" element={<About />} />
  </Routes>
  <Footer />
</BrowserRouter>
about 4 years ago · Juan Pablo Isaza Relatório

0

I have also encountered similar problems to you before. Does the content in the routing block the Header and Footer. you can change style of layout

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