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
dropping a draggle block between an array of droppable elements not working correctly

I am working with react-dnd. What I am trying to achieve is dragging the block from the left and dropping it between already existing blocks. I have tried to replicate my issue in codesandbox. Link to which is here I am facing two issues here

First Issue:

As we continue to add blocks from the leftbar their is some issue and the blocks stop getting added to the rightbar. (To recreate the issue try adding couple of blocks to the rightbar, you can see it after adding 4 to 5 blocks).

code Reference:

after element is drop below function is called which i think where the exact issue is but not sure. You can find it in Dustbin.js file in codesandbox

const addBlock = (id, newBlock) => {
    const newBlockList = [...blocks];
    let index = newBlockList.findIndex((el) => el.id === id);
    if (index > -1) {
      newBlockList.splice(index, 0, newBlock);
      setBlocks(newBlockList);
    }
  };

Second Issue:

Since I am always adding the blocks above the droppable block. I am unable to figure out how to add the element to the last?

Please correct me what I am doing wrong? or any suggestions will be helpful.

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