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

157
Vistas
How to get react-DND to only show hover information for child rows instead of both child and parent?

I have a list that can expand out to have children. So something like...

- item 1
+ item 2
   -subItem 1
   +subItem 2
      -childItem
- item3

I have a DraggableRow coponent which define useDrop and useDrag. I the component finishes like so

 drag(drop(ref));

  // Add the reference to the element
  return (
    <div
      ref={ref}
      style={{
        opacity: isDragging ? 0 : 1,
        border: isDragging ? "1px solid hotpink" : "none"
      }}
    >
      {children}
    </div>
  );

which children may be just the cells of the row, or the cells of the first row and the subrows.

My problem is that the Hover method of useDrop is getting confused, constantly entering for the 'parent' row and then the child row when I hover over the child. I would like to only enter the hover method for the child row.

I've modified this so that I add an isOpen to the DraggableRow to distinguish a child row from a parent row and then only accept childRows in useDrop. this mostly works, however, if I'm hoving over an open row, but not any of it's children (so say I'm hoving over "item 2" in my example) I can't drop it, but would like to be able to drop on item 2 so long as I wasn't hovering over a child.

Is there a clean way to ensure only the lowest level row activates the useDrag?

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