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

126
Views
Concurrently expanding two separate Trees

I need help. I've got this code snippet: https://codesandbox.io/s/modern-fog-495lq?file=/src/App.js - there is a problem with expansion of my two tree items. I need to have state of my expansion tree (Child) in Parent Component, but now all of my tree items are expanded/not expanded concurentlly because of the state in Parent Component. Is there any solution to solve this problem? To have expand only one tree when it's clicked on? Thank you for your help.

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

0

Issue

This is happening because you use one state variable for both children. One child triggers the other.

Solution

Instead of a flag, keep an array, and push to array on expand, filter out on shrink

Live Demo

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!