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

258
Views
How do link my './Projects' file to app.js in React?
import "bootstrap/dist/css/bootstrap.min.css";
import Navbar from './components/Navbar';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Home from './components/Home';
import Projects from './components/Projects';
import About from './components/About';

function App() {
  return(
    <>
      <Router>
        <Navbar />
        <Home  />
        <Projects />
        <About/>
      </Router>
    </>
  );
}

export default App;

This is the code in './Projects':

import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

function Projects() {
    return (
        <h1>Proj</h1>
    );
}

export default Projects;

When I click the link for the Projects page the link doesn't display the content in function Projects(). Please help.

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

0

Try wrapping each component in a <Route> component. Something like this:

<Router>
  <Route path="/route/to/projects">
    <Projects/>
  </Route>
</Router>

There are a few different ways to do this with React Router. If you don't like the way I did it you can find more options here: React Router 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!