Extract State Logic to Redux --solve

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,

 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:

The problem is with your messageReducer. You need to include a conditional.
This conditional should add to the state when the action type is ‘ADD’ or else return the state.

Thanks man, I found my errors already! I appreciate

Perfect good to hear!

  case ADD:
  return [...state, action.message];
  return state