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

172
Views
Nothing appears while using react router

I have a problem with react Router.

So i am building the nav of an website and when i'm doing the routes, nothing appears.

Would you help me please to see what i'm doing wrong?

The page stays white. Nothing appears, even the root doesnt see the homepage. ........................................................................................ Homepage:

import React from 'react';
import Navbar from '../allpages/navbar/Navbar';
import {
    BrowserRouter as Router, Routes, Route
} from "react-router-dom";
import Contact from "../contact/Contact";
import About from "../about/About";
const Home = () => {
    return (
        <>
            <Router>
                <Navbar />
                <Routes>
                    <Route  path="/about" element={About} />
                    <Route  path="/contact" element={Contact} />
                    <Route exact path="/" element={Home} />
                </Routes>
            </Router>

            <h3>Home</h3>
        </>
    )
}

export default Home

Navbar:


import React from 'react';

import {
    BrowserRouter as  Link
} from "react-router-dom";

const Navbar = () => {
    return (
   
            <div>
                <nav>
                    <ul>
                        <li>
                            <Link to="/home">Home</Link>
                        </li>
                        <li>
                            <Link to="/about">About</Link>
                        </li>
                        <li>
                            <Link to="/contact">Contact</Link>
                        </li>
                    </ul>
                </nav>
            </div>
        
        
    )
}

export default Navbar

main app:

import './App.css';
import Home from './components/home/Home'
function App() {
  return (
    <>
      <Home />
    </>
  );
}

export default App;

contact:

import React from 'react';

const Contact = () => {
    return (
        <div>
            <h3>Contact</h3>
        </div>
    )
}

export default Contact

About:

import React from 'react';
const About = () => {
    return (
        <div>
            <h1>About</h1>
        </div>
    )
}

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

0

So besides this typo:

 { BrowserRouter as Link } // use just Link

which is inside Navbar.js

I would also use recommended approach by React-Router team. Which uses <Switch> component to wrap pages. You are using Routes instead, idk if this is even valid. You can check this example: https://v5.reactrouter.com/web/example/basic which is really similar to your code.

about 4 years ago · Juan Pablo Isaza Report

0

What versión is you using? You might be out of dated

<React.Suspense fallback={<p>Loading...</p>}>
                <Routes>
                    <Route path="/*" element={<Outlet />}>
                  
                    <Route path="informacion-financiera" element={<Financiera />} />
                    <Route path="derechos-de-autor" element={<Author />} />
                    <Route 
                    </Route>
                </Routes>
            </React.Suspense>
    ```
about 4 years ago · Juan Pablo Isaza Report

0

What versión is you using? You might be out of dated

<React.Suspense fallback={<p>Loading...</p>}>
                <Routes>
                    <Route path="/*" element={<Outlet />}>
                  
                    <Route path="informacion-financiera" element={<Financiera />} />
                    <Route path="derechos-de-autor" element={<Author />} />
                    <Route 
                    </Route>
                </Routes>
            </React.Suspense>
    ```


You have browserRouter as Link so yow links are not links
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!