# Simple
If a
Container
does not bind with :get-child-payload, theelement
returned inside both@drop
and@dropReady
come asundefined
.
Click here to expand the code for the helpers functions
applyDrag(arr, dragResult) {
const { removedIndex, addedIndex, payload } = dragResult;
if (removedIndex === null && addedIndex === null) return arr;
const result = [...arr];
let itemToAdd = payload;
if (removedIndex !== null) {
itemToAdd = result.splice(removedIndex, 1)[0];
}
if (addedIndex !== null) {
result.splice(addedIndex, 0, itemToAdd);
}
return result;
},
generateItems(count, creator) {
const result = [];
for (let i = 0; i < count; i++) {
result.push(creator(i));
}
return result;
},