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

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

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 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