React - getting a component from a DOM element for debugging

Detection score: 4.0

<p>I have been using this function:</p>

<pre><code>window.FindReact = function (dom) {
  for (var key in dom) {
    if (key.startsWith('__reactInternalInstance$')) {
      var compInternals = dom[key]._currentElement;
      var compWrapper = compInternals._owner;
      var comp = compWrapper._instance;
      return comp;
    }
  }
  return null;
};
var someElement = $x("someElement")[0];
window.FindReact(someElement).setState({
  hover: true
});
</code></pre>

<p>To hover over elements in our website but since React 16, this is broken with an error </p>

<p>'VM25001:1 Uncaught TypeError: Cannot read property '_owner' of undefined
    at window.FindReact (:1:181)
    at :3:18'</p>

<p>Does anyone know how to fix this? 
Please help!</p>
Posted 11 days ago | reported 11 days ago
Posted by user9174281 (1)

Caught by 3 reasons: