What you need to know

Event listeners, intervals, and subscriptions can keep references alive after a UI is gone. In component-based apps they can also accumulate each time an effect runs.

How to apply it

Keep a reference to the handler, remove it during cleanup, clear timers, and abort fetches that no longer matter. Review effects whenever their dependencies change.

Common mistake to avoid

Do not create a new anonymous listener in one place and expect to remove it with another anonymous function. Cleanup needs the original handler reference.