Tell us what’s happening:
Dispatching addMessage against the store should immutably add a new message to the array of messages held in state.
Your code so far
// define ADD, addMessage(), messageReducer(), and store here:
const ADD = 'ADD';
const addMessage = (message) => {
return {
type: ADD,
message: message
};
};
const defaultStatus = [];
const messageReducer = (state = defaultStatus, action) => {
switch(action.type) {
case ADD:
return [...state, action.message];
default:
return state;
}
}
const store = Redux.createStore(messageReducer);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/extract-state-logic-to-redux/