Skip to content

Commit 38ee8d2

Browse files
authored
Add note about StrictMode not as the root component (#7702)
1 parent 9f87530 commit 38ee8d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/content/reference/react/StrictMode.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ function App() {
122122

123123
In this example, Strict Mode checks will not run against the `Header` and `Footer` components. However, they will run on `Sidebar` and `Content`, as well as all of the components inside them, no matter how deep.
124124

125+
<Note>
126+
127+
When `StrictMode` is enabled for a part of the app, React will only enable behaviors that are possible in production. For example, if `<StrictMode>` is not enabled at the root of the app, it will not [re-run Effects an extra time](#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development) on initial mount, since this would cause child effects to double fire without the parent effects, which cannot happen in production.
128+
129+
</Note>
130+
125131
---
126132

127133
### Fixing bugs found by double rendering in development {/*fixing-bugs-found-by-double-rendering-in-development*/}

0 commit comments

Comments
 (0)