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

166
Visualizações
React.js router element error stated as null

I'm making a React.js file with two buttons through bootstrap. The rendering code is:

import './App.css';
import Nav from './components/Nav';
import Home from './components/Home';
import Tweet from './components/Tweet';
import {BrowserRouter as Router, Routes, Route} from 'react-router-dom';


function App() {
  return (
    <Router>
    <div className="App">
      <header className="App-header">
        <Nav />
        <Routes>
          <Route path='/' exact component={Home} />
          <Route path='/tweets' exact component={Tweet} />
        </Routes>
      </header>
    </div>
  </Router>
  );
}

export default App;

but I get an error, that

Matched leaf route at location "/tweets" does not have an element. This means it will render an with a null value by default resulting in an "empty" page.

Can anyone help me?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

the Route component need 2 required property, path and element (not component). you set a component property and that is undefined. just you set your component to element property :

<Route path='/' exact element={Home} />
<Route path='/tweets' exact element={Tweet} />
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