You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We only disable the console in the second call, you should still see logs from the first call.
Starting with React 17, React automatically modifies the console methods like console.log() to silence the logs in the second call to lifecycle functions.
If we didn't do this, the console would contain duplicate messages so we made the tradeoff to disable it in the second pass. This can have side effects, which we offer a workaround for.
Hey @rickhanlonii thanks for the explanation. You actually highlighted the underlying issue I am having! I'm trying to write a child reconciler right now and eventually discovered the existence of the two passes.
Would you be able to direct me to the design/intent for this two-pass approach or maybe how to disable it for child-reconcilers in the tree?
It's noted on the docs pages at https://reactjs.org/docs/strict-mode.html
react-dom currently disables/mutates the global console in strict mode.
This seems to be an intentional feature/bug that's an unnecessary inconvenience.
React version: 17.0.1
Steps To Reproduce
The current behavior
logging is disabled in strict-mode
The expected behavior
Possible better solutions:
The text was updated successfully, but these errors were encountered: