Basic Redux does this mutate state?

Tell us what’s happening:
I believe my code below doesn’t change state, can someone explain to me in case that i’m wrong about it? in the answers of freecodecamp doesn’t allow me to do it like that

Your code so far

const immutableReducer = (state = [0,1,2,3,4,5], action) => {
switch(action.type) {
  case 'REMOVE_ITEM':
    return [
      ...state.filter(el => el !== action.index)
    return state;

const removeItem = (index) => {
return {
  type: 'REMOVE_ITEM',

const store = Redux.createStore(immutableReducer);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36.

Challenge: Remove an Item from an Array

Link to the challenge:

I do find the requirement a bit confusing.

But it wants you to remove elements at the index, not remove elements whose values are equal to the index.

1 Like

can somebody let me know why I am not able to proceed with the React- Redux first lesson? Code seems to be right, but I am getting // running tests in the console and nothing further. Please help me out.

@simransuresh410 Please make a new thread.

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.