5 hands-on exercises and 5 find-the-bug challenges for the useReducer Explained lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Increment through a reducer instead of useState.
Support both increment and reset.
Send a value along with the action.
Update one field of an object state through the reducer.
Append an item immutably from the reducer.
An unmatched action must return the state unchanged.
The reducer changes the state in place instead of returning a new value.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceThe reducer ignores the value carried by the action.
The reducer replaces the object rather than copying it.
Dispatch the action; do not call the reducer yourself.