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

412
Views
Blank Page after using Route in React

This is my App.js

    import "./App.css";
import Header from "./component/layout/Header/Header.js";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import React from "react";
import Home from "./component/Home/Home.js";

function App() {
  return (
    <Router>
      <Header />

        <Route exact path="/" component={Home} />

      <Footer />
    </Router>
  );
}

export default App;

This is my Home.js


const Home = () => {
  return (
    <Fragment>
      <div className="banner">
        <p>Welcome to My Website</p>
      </div>
    </Fragment>
  );
};

export default Home;

Edit: i managed to remove the black page after wrapping the Route but the text in Home.js doesn't show "Welcome to My Website"

<Routes>

 <Route exact path="/" component={Home} />

</Routes>

this code ^ removed the blank page but the result is that the text from Home.js "Welcome to My Website" didn't show. How can I route correctly to the Home component?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are using v6 react-router-dom, you have to replace component to element

<Routes>
 {/* <Route exact path="/" component={Home} /> */}
 <Route exact path="/" element={<Home />} />
</Routes>
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!