Skip to content

Instantly share code, notes, and snippets.

@kulakowka
Created August 13, 2018 00:33
Show Gist options
  • Save kulakowka/d8136f99bad1879c4626ac78bb8d8721 to your computer and use it in GitHub Desktop.
Save kulakowka/d8136f99bad1879c4626ac78bb8d8721 to your computer and use it in GitHub Desktop.
react debug component
var devtools = /./;
devtools.toString = function() {
this.opened = true;
};
console.log("%c", devtools);
// devtools.opened will become true if/when the console is opened
export default props => {
if (devtools.opened) {
return props.children;
}
return null;
};
@kulakowka
Copy link
Author

import Devtool from './devtools.js'

<Devtool><pre>{JSON.stringify(object, null, 2)}</pre></Devtool>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment