I am using splice to remove an element from an array, but it's not working. as far as I know, the code looks okay , but maybe I am missing/overseeing something. please take a look. here 'state' is an array containing objects.
let removeFromState = state;
for(var i=0;i<removeFromState.length;i++){
if(removeFromState[i].index===action.index){
removeFromState.splice[i,1];
}
}
return removeFromState;
I cant believe, i was being so silly. and i had been looking at it for quite a while but didnt see it right in front of me. but I am glad i posted it here, because of the remarks about missing entries because I was increasing 'i' even though I was removing entries.