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

180
Views
How to use div like link to redirect to another page?

I need to make div which will act simulate to Link element, so when you click on it you navigate to another page.

Something like this

<Link to="/employees">
   ...  
</Link>

But it has to be div.

I could use onClick but when I use it, I should use whole path https://pro.websire.com/employees. I don't want to use it because we have different versions of website.

So path should be exactly like in Link element

<div onClick={to('/employees')}>
  ...
</div>

Does anyone know is it possible to do ?

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

0

If you are using react router, you can programmatically navigate using the useNavigate hook. Inside your component, you need to do the following.

const LinkComponent = () =>{
    const navigate = useNavigate()
    return(<div onClick={() => navigate("/home")}>Link </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!