I have a handledragover event, from where I am calling a function to remove an item from an array.The following is my code
function handleDragOver(e) {
const { active, over } = e
if (over.id === "trash") {
console.log("I am in trash");
removeItemFromCanvas(active.id);
}
}
const removeItemFromCanvas = (itemId) => {
console.log(itemId);
setCanvasItems((prevItems) =>
prevItems.filter((item) => item.instanceId !== itemId)
);
};
My console log for item id is 1685584897944 and my array items are
{id: 3, name: 'Item 3', instanceId: 1685584897944}
{id: 2, name: 'Item 2', instanceId: 1685585098521}
{id: 1, name: 'Item 1', instanceId: 1685585099515}
Though the first item is not matching, the array with the same elements are returned without filtering. Please help