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

81
Views
¿Cómo obtener la última parte de la URL actual con el enrutador de reacción v6?

¿Cómo puedo obtener la última parte de la URL actual con el enrutador de reacción v6?

Por ejemplo:

Si la ruta actual es https://localhost:4200/example/example-details , entonces quiero verificarlo así

 const location = useLocation(); if (location.pathname === '/example-details')) { // do some stuff here }

..pero esto siempre devuelve la ruta completa.

Funciona con location.pathname.includes('/example-details') , pero tengo curiosidad por saber si hay alguna forma con el enrutador de reacción, como es posible con el enrutador Angular.

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

0

comprobar

 location.pathname.includes('/example-details')
about 4 years ago · Juan Pablo Isaza Report

0

const location = useLocation(); const [pathName, setPathName] = useState(null) ; useEffect(() => { if(location) { let tmp = location.pathName.slice(location.pathName.lastIndexOf("/") , location.pathName.length) ; setPathName(tmp) ; } }, [location])
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!