Quiz 5

Test your knowledge on reducers.

Q

Does the following code that is used to combineReducers function properly?

const combineReducers = (reducersMap) => {
  return (state = {}, action) => {
    const newState = {};

    Object.entries(reducersMap).forEach(([subStateName, subReducer]) => {
      newState[subStateName] = subReducer(state[subStateName], action);
    });

    return newState;
  };
};
A)

Yes

B)

No

Get hands-on with 1400+ tech skills courses.