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

297
Views
Cómo usar matchPatch con enlaces dinámicos en React Router v6

La ruta que intento encontrar es /threats/live/:id

Tenemos un componente en el que generalmente representamos nuestras breadcrumbs de pan y así fue como se crearon usando el react router v5 :

 const breadcrumbOptions = routes .filter((route) => matchPath(pathname, { path: route.link, exact: false })) .map((route) => ({ ...route, label: route.breadCrumbtitle, onclick: undefined, }))

Para v6 , esto no parece funcionar porque busca :id en la url , pero en su lugar encuentra la id real.

He intentado lo siguiente, pero todavía no funcionó para mí

 const breadcrumbOptions = routes .filter((route) => matchPath( { path: pathname, caseSensitive: false, end: false }, route.link ) ) .map((route) => ({ ...route, label: route.breadcrumbTitle, onclick: undefined, }))
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que en v6 se invirtieron los parámetros de función de matchPath .

¿Podrías intentar hacer

 matchPath(route.link, pathname)

¿en cambio?

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!