Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactuseReducerSingle-choice MCQ

A reducer is written so each action returns a new state object. After dispatching an action whose handler hits no matching case and returns the existing state object unchanged, what happens to the component?

function reducer(state, action) { switch (action.type) { case 'inc': return { count: state.count + 1 }; default: return state; // same reference } } function Counter() { const [state, dispatch] = useReducer(reducer, { count: 0 }); // user dispatches { type: 'noop' } return <span>{state.count}</span>; }