Skip to content

Commit ff8a06c

Browse files
authored
Clarify that Effects are double-invoked only on mount in StrictMode
1 parent 6fc98ff commit ff8a06c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/reference/react/StrictMode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Strict Mode can also help find bugs in [Effects.](/learn/synchronizing-with-effe
511511
512512
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.
513513
514-
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.
514+
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.
515515
516516
**Here is an example to illustrate how re-running Effects in Strict Mode helps you find bugs early.**
517517

0 commit comments

Comments
 (0)