>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

Thinking Functionally — Immutability and Pure Functions

Question 1 / 1

0:00
Core
Medium

A developer writes the following Redux reducer for the Color Organizer:

const colorsReducer = (state = [], action) => {
  if (action.type === 'ADD_COLOR') {
    state.push(action.color)
    return state
  }
  return state
}

In a unit test, dispatching ADD_COLOR three times and checking store.getState().length correctly returns 3. But in the React app, the connected ColorList component never re-renders after the first dispatch. What is the root cause?