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

141
Vistas
Nested destructuring doesn't work in React?

So i have done some restful routing in my react app and want to access the parameters.

And this does work:

const TreeList = ( props ) => {
    return (
        <div>
            <p>{`Trees filterd by ${props.match.params.searchBy}, with the key of ${props.match.params.key}.`}</p>
        </div>
    )
}

So does this:

const TreeList = ( {match} ) => {
    return (
        <div>
            <p>{`Trees filterd by ${match.params.searchBy}, with the key of ${match.params.key}.`}</p>
        </div>
    )
}

But when I tried to destructure it further, I came across JS nested destructuring, which should look like this:

const TreeList = ( {match: {params}} ) => {
    return (
        <div>
            <h1>TreeList</h1>
            <p>{`Trees filterd by ${params.searchBy}, with the key of ${params.key}.`}</p>
        </div>
    )
}

But it doesn't work. :(

about 4 years ago · Juan Pablo Isaza
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