I am working on the React and Redux challenges. On the third challenge ‘extract state logic to redux,’ I am stuck. I think my code is pretty much the same as the solution but it’s not passing the test.
const ADD = "ADD";
const addMessage = (message) => {
return {
type: ADD,
message: message
};
};
const messageReducer = (action, Prestate=[]) => {
switch(action.type) {
case ADD:
return [...Prestate, action.message];
break;
default:
return Prestate;
}
};
const store = Redux.createStore(messageReducer);
and the tests not passed
