cantera cantera - 3 years ago 200
React JSX Question

Disable/Hide "Download the React DevTools..."

How do you completely disable or hide the "persistent" console message:

Download the React DevTools for a better development experience
while in development?

Answer Source

Put this line somewhere in the global scope (it won't work if you put it inside a bundled module):

__REACT_DEVTOOLS_GLOBAL_HOOK__ = true;

Here's a related gist from Ryan Florence that's the basis for the above hack:

if (
  process.env.NODE_ENV === 'production' &&
  window.__REACT_DEVTOOLS_GLOBAL_HOOK__ &&
  Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length
) {
  window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers = {}
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download