This is a question using this problem as an example. The reducer is using action.todo. todo is not being called as a function like action.todo() but seems to be used as a property. There doesn’t seem to be a defining of todo on action. How is the reducer using the addTodo action creator?
const immutableReducer = (state = ['Do not mutate state!'], action) => {
switch(action.type) {
case 'ADD_TO_DO':
// Don't mutate state here or the tests will fail
return [...state, action.todo];
default:
return state;
}
};
const addToDo = (todo) => {
return {
type: 'ADD_TO_DO',
todo
}
}
const store = Redux.createStore(immutableReducer);