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

118
Views
React Nav Links Not Displaying Content

I'm new to learning React so I'm wondering if anyone can help me. I'm currently building a portfolio through React and I'm working on the Nav for this. I'm not getting any errors in the Console and when I click on each Link, it displays the Link I've clicked on in the URL but it won't show me any of my Content from each Link. Can anyone please help explain where I am going wrong?

App Code

import React from 'react';
import { BrowserRouter, Route, Link } from 'react-router-dom'; 
import Projects from './Projects.js'; 
import Contact from './Contact.js'; 
import About from './About.js'; 
import Skills from './Skills.js'; 
import Home from './App.js';
import './App.css';

function App() {
 return (
  <BrowserRouter>
    <div className="App">
          <Route path="/" element={<Home />}></Route>
          <Route path="/about" element={<About />}></Route>
          <Route path="/contact" element={<Contact />}></Route>
          <Route path="/projects" element={<Projects />}></Route>
          <Route path="/skills" element={<Skills />}></Route>

      <div className="navigation">
        <div className="navigation-sub">
          <Link to="/" className="item">Home</Link>
          <Link to="/about" className="item">About</Link>
          <Link to="/contact" className="item">Contact</Link>
          <Link to="/projects" className="item">Projects</Link>
          <Link to="/skills" className="item">Skills</Link>
        </div>
      </div>
    </div>
  </BrowserRouter>
 );
}

export default App;

index Code

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from 'react-router-dom';

ReactDOM.render(
 <React.StrictMode>
  <BrowserRouter>
    <App />
  </BrowserRouter>
 </React.StrictMode>,
 document.getElementById("root")
);

reportWebVitals();

About Code

import React from "react";

function About(props) {
  return (
    <div>
      <h1>About Me</h1>
   </div>
  )
}

export default About;

Thanks :)

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

0

You are already rendering a BrowserRouter around App, so remove the extraneous BrowserRouter from App. The Route components are also missing being wrapped in a Routes component that handles path matching. It's a required component. You should have some console errors warning of invariant violations for the rendering of a router within another router and the routes not being wrapped directly by a Routes component.

import { Routes, Route } from 'react-router-dom';

function App() {
  return (
    <div className="App">
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/about" element={<About />} />
        <Route path="/contact" element={<Contact />} />
        <Route path="/projects" element={<Projects />} />
        <Route path="/skills" element={<Skills />} />
      </Routes>
      <div className="navigation">
        <div className="navigation-sub">
          <Link to="/" className="item">Home</Link>
          <Link to="/about" className="item">About</Link>
          <Link to="/contact" className="item">Contact</Link>
          <Link to="/projects" className="item">Projects</Link>
          <Link to="/skills" className="item">Skills</Link>
        </div>
      </div>
    </div>
  );
}
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!