State Management · Junior · Question 9 of 75
What does useReducer return?
const [state, dispatch] = useReducer(reducer, initialState);- ✓Correct answer: The current state and a
dispatchfunction to send actions - 2The reducer function and a copy of the initial state
- 3A promise that resolves with the new state
Explanation
You call dispatch({ type: 'added', text }), React calls reducer(state, action) and uses the returned value as the next state. dispatch is stable across renders, so it's safe to pass down and to use in effect dependencies.