score:0

Accepted answer
const [items, setitems] = usestate([1, 2]);

items immutable. you can't manipulate that variable. you will have to make a new variable by spreading contents of items and do the manipulation on that, before updating values using setitems.

invalid

items.splice(index, 0, draggeditem);

valid

let newvaritem = [...items]
newvaritem .splice(index, 0, draggeditem);  

Related Query

More Query from same tag