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

143
Views
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
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!