Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!