5 hands-on exercises and 5 find-the-bug challenges for the Updating State Correctly lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Use the updater form twice so both increments land.
Append an item without mutating the existing array.
Copy the object and change a single field.
Filter out one item rather than splicing in place.
Copy both levels to change a nested value.
Both calls read the same stale value, so only one increment applies.
push changes the same array, so React sees no new value.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceThe other fields are lost because the copy was skipped.
Changing a field in place gives React the same object back.
The spread sets city on the outer object, but the city lives inside address.