1case COMPLETE_TODO: {
2 const index = state.todos.findIndex(todo => todo.id === action.payload); //finding index of the item
3 const newArray = [...state.todos]; //making a new array
4 newArray[index].completed = true//changing value in the new array
5 return { ...state, //copying the orignal state
6 todos: newArray, //reassingning todos to new array
7 }
8}