Skip to content

Commit

Permalink
[react-dom] Provide a way to silence devtools recommendation
Browse files Browse the repository at this point in the history
If you hit this console message and search for how to turn it off, many people recommend hacky ways to do so that also end up breaking the extension if you actually want to use it later on.

This provides a way to turn off just the message, without trying to trick injectIntoDevTools into thinking something's happened.
  • Loading branch information
rtpg committed Apr 26, 2024
1 parent c408361 commit dbed8fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-dom/src/client/ReactDOMClient.js
Expand Up @@ -57,7 +57,7 @@ const foundDevTools = injectIntoDevTools({
});

if (__DEV__) {
if (!foundDevTools && canUseDOM && window.top === window.self) {
if (!foundDevTools && canUseDOM && window.top === window.self && !window.__DONT_RECOMMEND_REACT_DEVTOOLS__) {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (
(navigator.userAgent.indexOf('Chrome') > -1 &&
Expand Down

0 comments on commit dbed8fa

Please sign in to comment.