Effect Cleanup Functions
The function returned from an effect runs before the effect re-runs and again on unmount, undoing the subscription, timer, or connection the effect created. Correct cleanup makes an effect idempotent: setup and teardown must be exact inverses, which is precisely what StrictMode's setup/cleanup/setup cycle verifies.
This Concept is waiting for its first lesson!
The function returned from an effect runs before the effect re-runs and again on unmount, undoing the subscription, timer, or connection the effect created. Correct cleanup makes an effect idempotent: setup and teardown must be exact inverses, which is precisely what StrictMode's setup/cleanup/setup cycle verifies.
Are you a teacher? Sign in to start contributing.
Sign In