-1

i'm trying to install react-devtools-inline inside window object. I understand, this is mainly used for iframes and react apps embedded inside them, but i would like to have it installed on main window.

I dynamically render some React components with document.body.appendChild(script). I'm able to register the inline-devtools beforehand, but when i try to do so, i get Uncaught TypeError: hook.sub is not a function This all is happening with chrome extension react devtools disabled.

Is there any way to register react-devtools-inline on main window?

thanks

Martin Mecir
  • 80
  • 1
  • 8

1 Answers1

0

You can try to inject inside your content a self called function. I use this method for redux-devtools.

const func = `(${String(this._headFunction)})()`;
const xhrOverrideScript: HTMLScriptElement = document.createElement('script');
xhrOverrideScript.type = 'text/javascript';
xhrOverrideScript.innerHTML = func;
document.head.prepend(xhrOverrideScript);