Quiz 2

Test your knowledge of the content learned up till now.

1

The following code is used to implement a reducer that will accept a “SCORE_POINT” action and will increment the score of a specific team by 1

const initialState = {
  red: 2,
  blue: 1
}

const scoreReducer = (state = initialState, action) => {
  if (action.type === "SCORE_POINT") {
    return { ...state, [action.team]: state[action.team] + 1 }
  }

  return state;
}

Are there errors within the code?

A)

Yes

B)

No

Question 1 of 20 attempted

Get hands-on with 1200+ tech skills courses.