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

This issue has been tracked 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:
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.

More Details About Repo
Owner Name facebook
Repo Name react
Full Name facebook/react
Language JavaScript
Created Date 2013-05-24
Updated Date 2022-10-03
Star Count 195549
Watcher Count 6650
Fork Count 40505
Issue Count 1119


Issue Title Created Date Updated Date