Extract State Logic to Redux 4

Extract State Logic to Redux 4
0.0 0


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];
            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:


When I rename the defaultStatus to initial, it’s work!