From ff8a06c089ff6b0bee572e07dd7cf5abd5281f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 6 Feb 2025 09:30:22 +0100 Subject: [PATCH] Clarify that Effects are double-invoked only on mount in StrictMode --- src/content/reference/react/StrictMode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react/StrictMode.md b/src/content/reference/react/StrictMode.md index 5b62794bcf6..dd669ec50eb 100644 --- a/src/content/reference/react/StrictMode.md +++ b/src/content/reference/react/StrictMode.md @@ -511,7 +511,7 @@ Strict Mode can also help find bugs in [Effects.](/learn/synchronizing-with-effe Every Effect has some setup code and may have some cleanup code. Normally, React calls setup when the component *mounts* (is added to the screen) and calls cleanup when the component *unmounts* (is removed from the screen). React then calls cleanup and setup again if its dependencies changed since the last render. -When Strict Mode is on, React will also run **one extra setup+cleanup cycle in development for every Effect.** This may feel surprising, but it helps reveal subtle bugs that are hard to catch manually. +When Strict Mode is on, React will also run **one extra setup+cleanup cycle in development for every Effect on mount.** This may feel surprising, but it helps reveal subtle bugs that are hard to catch manually. **Here is an example to illustrate how re-running Effects in Strict Mode helps you find bugs early.**