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

121
Views
React Router Dom v6 not working in my React page

This is my app.js I'm trying to preview the code but it's showing a blank page like extremely blank not even with an error while on my terminal it says compiled successfully!

import TopBar from './components/topbar/TopBar';
import Home from './pages/home/home';
import Write from './pages/write';
import Single from './pages/single';
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
function App() {
  return (
    <>
    <Router>
      <TopBar/>
      <Routes>
         <Route exact path ="/" element = {Home} />      
         <Route path ="/write" element = {Write} />
         <Route path ="/single" element = {Single} />
    
      </Routes>
   
    </Router>
    
    </>
  );
}

export default App;

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

0

With React Router Dom v6 you should be calling the given component to element property, like so:

<Route exact path ="/" element = {<Home/>} />      
<Route path ="/write" element = {<Write/>} />
<Route path ="/single" element = {<Single/>} />
about 4 years ago · Juan Pablo Isaza Report

0

Check your browser console to see more details.

but as far as i know in version 6 there is no exact in <Route/> props remove it

about 4 years ago · Juan Pablo Isaza Report

0

try removing exact and using child routers I think that would help

 function App() {
    return (
      <>
        <Router>
          <TopBar />
          <Routes>
            <Route path="/" element={Home}>
              <Route path="write" element={Write} />
              <Route path="single" element={Single} />
            </Route>
          </Routes>
        </Router>
      </>
    );
  }
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!