Redux section - Never mutate state

**Hey guys!
Please , i need some help , i am stuck with this code in Redux section – Never mutate state , everything correct with me , but in test they say

The Redux store should exist and initialize with a state equal to the todos array in the code editor.
```![Screenshot_2021-02-28 freeCodeCamp org|690x376](upload://9p4Rj9c77ygka5t3rREhiesjprw.png) 
**

      **Your code so far**
      
```js

const ADD_TO_DO = 'ADD_TO_DO';

// A list of strings representing tasks to do:
const todos = [
'Go to the store',
'Clean the house',
'Cook dinner',
'Learn to code',
];

const immutableReducer = (state = todos, action) => {
switch(action.type) {
  case ADD_TO_DO:
    // Don't mutate state here or the tests will fail
    let newState = todos.slice();
    newState.push(action.todo);
    return newState;
  default:
    return state;
}
};

const addToDo = (todo) => {
return {
  type: ADD_TO_DO,
  todo
}
}

const store = Redux.createStore(immutableReducer);

store.dispatch(addToDo('learn Redux 2021'));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:85.0) Gecko/20100101 Firefox/85.0.

Challenge: Never Mutate State

Link to the challenge:

It’s the store.dispatch call at the end confusing the test. Without it tests passes.

1 Like

Yeah bro ! its work , A big thanks to you :star_struck: