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

161
Views
Scroll through section using react

I want to add a scroll-down effect to my "single page" web app using react or be it scroll library i.e when I click on navbar links it should scroll to a particular section.

This is my nav.js

      <div className="wrapper">
    <div className="left">
      <div className="navlinks">
        <Link to="/">Home</Link>
        <Link to="/about">About</Link>
        <Link to="/portfolio">Portfolio</Link>
        <Link to="/contact">Contact</Link>
      </div>
    </div>

app.js

function App() {
const [menuOpen, setMenuOpen] = useState(false);
return (
<div className="app">
<Router>
<Switch>
<Route path="/contact">
<Contact />
</Route>
<Route path="/portfolio">
<Portfolio />
</Route>
<Route path="/about" component={About}/>
<Route exact path="/">
<Nav open={menuOpen} setOpen={setMenuOpen} />
<Home />
<Footer />
</Route>
</Switch>
</Router>
</div>

); }

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

0

You can take a look at this question How to scroll to an element?

Using Ref, as Digamber said you should not use Router in this case.

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!