Tell us what’s happening:
I think the code is accurate, I can’t find the mistake if anyone can help… please do
Your code so far
const immutableReducer = (state = [0,1,2,3,4,5], action) => {
switch(action.type) {
case 'REMOVE_ITEM':
let newarr=state.slice(0,action.index).concat(state.slice(action.index,state.length));
return newarr;
// don't mutate state here or the tests will fail
default:
return state;
}
};
const removeItem = (index) => {
return {
type: 'REMOVE_ITEM',
index
}
}
const store = Redux.createStore(immutableReducer);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0
.
Challenge: Remove an Item from an Array
Link to the challenge: