Idea: Add a console.log hint why components get remounted in StrictMode

This issue has been created since 2022-09-15.

I experienced a couple times now the developers using React upgraded to React 18 or started a new project, had no idea about the new StrictMode behaviour and lost a lot of time figuring out that this is not bug in their code.

I wonder if it makes sense to inform them in the console and lead them to content explaining why. Ideally it could be turned off via the react-dev-tools.

Because you are using StrictMode in development React will unmount and remount
every component, whenever a component mounts for the first time. Due remounting
useEffect and useLayoutEffect run twice. Learn more here why it's important:
https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state
castelstack wrote this answer on 2022-09-21

"StrictMode is a tool for highlighting potential problems in an application. Like Fragment, StrictMode does not render any visible UI. It activates additional checks and warnings for its descendants."

that means there's no need to hint. you will still have to debug it by yourself or remove React.StrictMode to stop remounting.

https://reactjs.org/docs/strict-mode.html

More Details About Repo
Owner Name facebook
Repo Name react
Full Name facebook/react
Language JavaScript
Created Date 2013-05-24
Updated Date 2022-09-27
Star Count 195296
Watcher Count 6655
Fork Count 40431
Issue Count 1113

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Feature Request: Self Documenting API (OpenAPI / Swagger) 1 2022-09-11 2022-09-26
Multiple "Canonical JSON" definitions not distinct in spec 3 2022-09-22 2022-09-26
Canonical JSON does not specify how to handle duplicate key values 1 2022-09-22 2022-09-26
Super Lazy Pages - lazy store in storage 0 2022-04-19 2022-09-11
Error importing .ldtk project 2 2021-05-19 2022-08-01
Text input doesn't bring up virtual keyboard on mobile 2 2021-05-21 2022-09-02
[BUG] Investigate call command with TinyGo actors 1 2021-05-04 2022-09-07
[BUG] Rename the lattice event topic to wasmbus.evt.(prefix) 1 2021-04-25 2022-09-07
Discord splash screen window remains in taskbar 4 2022-03-19 2022-07-31
Pinned LibreOffice icon in IconTasklist disappears when opening a document 7 2022-04-11 2022-08-15
Workspace applet: apps icons no longer visible 1 2022-04-11 2022-08-21
JSON export and attached document 8 2018-12-07 2022-09-17
(chore) `vuejs/core` repo about: update `v3.vuejs.org` link to `vuejs.org` 1 2022-03-04 2022-09-01
meetup: first meet-up, make it happen 6 2019-10-03 2021-12-25
How can I change Progress bar Color? 0 2021-09-17 2022-09-16
update_tags breaks COG format 2 2022-01-04 2022-09-25
RFE: Monitoring module 1 2021-08-29 2022-07-30
Addin manager [more info link] fails 1 2021-08-25 2022-07-28
[Feature]增加类似视频屏蔽的动态屏蔽功能 1 2021-12-13 2022-09-13
希望增加动态关键词屏蔽 1 2021-12-13 2022-01-16
[question/feature] Benchmarks / Requests per second 1 2018-09-24 2022-09-24
Some link text was merged by mistake 0 2021-10-20 2022-08-07
client Error : No module named 'numpy' 0 2021-09-26 2022-08-04
remesh triangle mesh to improve the quality of original mesh 0 2021-10-29 2022-07-21
error on Depth.Quality.Tool 2.49 and Intel.RealSense.Viewer 2.49 but works fine on version 2.40 3 2021-09-03 2022-07-19
Error in f(...) : Graphics API version mismatch 1 2021-09-09 2022-08-26
Because of read only file system, I cannot save emails on disk 2 2021-04-22 2022-09-10
Auto-indexing for on prem instances GA 0 2022-02-08 2022-02-01
Linux: Flaky Test and AssetProcessorConnection::ConnectThread Fail 4 2022-02-26 2022-09-25
UI lags when opening or closing a tab 1 2022-08-31 2022-09-26
[dart-sass]: `hoistUseStatements` causes problems with @use ... with() 7 2021-01-06 2022-09-10
[vectorIcons] Icon color in stored list changes dynamicly when scrolling 9 2021-09-20 2022-09-15
Removing return type on default_backend makes the function untyped. 5 2022-04-27 2022-08-11
Don't draw stellar halos if the star is obscured 7 2021-09-26 2022-08-13
Help: How to reload the visible cell or pervious edited cell 0 2021-11-18 2022-09-10
Building new vehicle failed [following the doc] 1 2022-02-28 2022-09-12
multi_distinct_sum on decimal types gives wrong signatures that contains varchar and wildcard decimal 0 2022-07-06 2022-08-27
BigSerial doesn't generate int64 for params 2 2021-08-26 2022-08-31
systemd error when `/usr` not `neededForBoot` 2 2021-11-15 2022-08-17
`--report=json` emits a non-JSON nicely formatted error 6 2022-06-22 2022-09-02
Support for multiple displays on different controllers and more. Ideas and Reflections. 3 2021-09-20 2022-09-08
404 at /engine/reference/commandline/attach/) 1 2022-09-14 2022-09-16
[DepShield] (CVSS 7.7) Vulnerability due to usage of github.com/coreos:etcd:3.3.10 2 2020-08-27 2022-09-14
Plugins on android device throw TypeError: Cannot read properties of undefined (reading 'postMessage') 2 2022-06-10 2022-08-28
初次启动 vite 项目,先是跳转到 about:blank 空页面,然后跳转到实际页面 1 2021-12-29 2022-09-22
W11 / WSL2 stuck- reinstalling / rebooting not helpin 3 2021-09-02 2022-07-30
No decorations with shell integration 1 2022-07-24 2022-09-02
Shutdown as final packer step 0 2021-04-30 2022-09-15
Donate Block (streamlined): Include an option to set a minimum amount 2 2022-07-21 2022-09-18
Homepage Posts: Gap to the right of the blocks 1 2022-07-22 2022-09-18