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

320
Views
How to get Full Route History from useHistory in react-router

I am working on useHistory() hook. I need to fill the breadcrumbs from the useHistory route. I need to fill the breadcrumbs from where we came to home page or '/'.I don't know how to do it using useHistory.I know only few methods like goBack(). But it gives only the previous route. I need the whole history stack. Is there any way to get that in react?

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

0

For creating a breadcrumb, you could be making use of history's location object

Something like this:

function DashboardDetail() {
  const history = useHistory();

  const { pathname } = history.location;
  return (
    <div>
      <p>BreadCrumb: {pathname.split("/").join(" -> ")}</p>
      <h2>Dashboard Detail</h2>
    </div>
  );
}

Working Example:

Edit React Router - BreadCrumb

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!