Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

305
Vistas
How to use matchPatch with dynamic links on React Router v6

The path I'm trying to match is /threats/live/:id

We have a component where we usually render our breadcrumbs in and this was how they were built using react router v5:

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

For v6 this doesn't seem to work because it looks for :id in the url but instead finds the actual id.

I've tried the following but it still didn't work for me

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 Respuestas
Responde la pregunta

0

I think that in v6 the function parameters of matchPath were reversed.

Could you try to do

matchPath(route.link, pathname)

instead?

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda