Complete useReducer Dispatch
Fill in the Blank Medium
Question
Fill in the blank to dispatch an increment action.
Code
const [state, dispatch] = useReducer(reducer, { count: 0 });
_____{ type: "increment" };
Hint
Which function sends an action to the reducer?
Explanation
The dispatch function sends an action to the reducer. The reducer processes the action and returns the new state. This is the useReducer equivalent of calling a setState function.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.