Tell us what’s happening:
It’s saying:
The store should exist and have an initial state set to an empty array.
Dispatching addMessage against the store should immutably add a new message to the array of messages held in state.
The messageReducer should return the current state if called with any other actions.
Your code so far
// define ADD, addMessage(), messageReducer(), and store here:
const ADD = 'ADD';
const addMessage = (message) => {
return {
type: ADD,
message
};
};
const messageReducer = (state = [], action) => {
const newMessage = [...state, action.message];
return newMessage;
}
const store = Redux.createStore(messageReducer)
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/extract-state-logic-to-redux/