Question 1 / 1
A developer needs to update the rating on a specific color in a Redux reducer. They write:
case 'RATE_COLOR':
return colors.map(color => {
if (color.id === action.id) {
color.rating = action.rating
}
return color
})
The ColorList component re-renders (the array reference changed), but the matched color's displayed rating doesn't update. What is wrong and what is the correct fix?