5 hands-on exercises and 5 find-the-bug challenges for the Effect Cleanup lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Record that cleanup ran when the child unmounts.
Cancel the interval when the component goes away.
Detach the event listener in the cleanup.
Report whether the child is currently mounted.
Cleanup runs before the effect repeats when the id changes.
The effect never returns a cleanup function.
The cleanup runs immediately instead of being handed to React.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceThe interval keeps running because cleanup does nothing.
The cleanup removes nothing, so the listener stays.
Hiding should remove the child, not just change a label.