5 hands-on exercises and 5 find-the-bug challenges for the Effect Dependencies lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Let the effect run only on the first render.
Update the label whenever the count changes.
Re-run when either value changes.
Re-run the effect when the prop changes.
Avoid a stale value by using the updater form inside the effect.
The effect never re-runs, so it keeps showing the first value.
The effect watches a value that never changes.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceOnly one of the two values is watched.
The effect ignores the prop, so a new prop is not reflected.
The effect captured the first count; use the updater form.