title: react-cornerstone: Cannot read property 'getEnabledElement' of undefined
body: <p>I have a project which make a use of the react version of the cornerstone.js library. I'm using :<a href="https://github.com/cornerstonejs/react-cornerstone-viewport" rel="nofollow noreferrer">https://github.com/cornerstonejs/react-cornerstone-viewport</a></p>
  <p>I was creating a simple functional compononent to render the canvas on the screen:</p>
  <pre><code>import React, { useState } from &quot;react&quot;;
  import CornerstoneViewport from &quot;react-cornerstone-viewport&quot;;
  
  export const Test = (): JSX.Element =&gt; {
    const [cornerstone] = useState({
      tools: [
        // Mouse
        {
          name: &quot;Wwwc&quot;,
          mode: &quot;active&quot;,
          modeOptions: { mouseButtonMask: 1 },
        },
        {
          name: &quot;Zoom&quot;,
          mode: &quot;active&quot;,
          modeOptions: { mouseButtonMask: 2 },
        },
        {
          name: &quot;Pan&quot;,
          mode: &quot;active&quot;,
          modeOptions: { mouseButtonMask: 4 },
        },
        // Scroll
        { name: &quot;StackScrollMouseWheel&quot;, mode: &quot;active&quot; },
        // Touch
        { name: &quot;PanMultiTouch&quot;, mode: &quot;active&quot; },
        { name: &quot;ZoomTouchPinch&quot;, mode: &quot;active&quot; },
        { name: &quot;StackScrollMultiTouch&quot;, mode: &quot;active&quot; },
      ],
      imageIds: [
        &quot;dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.11.dcm&quot;,
        &quot;dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.12.dcm&quot;,
      ],
    });
  
    return (
      &lt;CornerstoneViewport
        tools={cornerstone.tools}
        imageIds={cornerstone.imageIds}
        style={{ minWidth: &quot;100%&quot;, height: &quot;512px&quot;, flex: &quot;1&quot; }}
      /&gt;
    );
  };
  </code></pre>
  <p>However I get this error:</p>
  <pre><code>Uncaught (in promise) TypeError: Cannot read property 'getEnabledElement' of undefined
      at _getUUIDFromElement (cornerstoneTools.js?b351:11117)
      at Object.setStartLoadHandler (cornerstoneTools.js?b351:11133)
      at CornerstoneViewport._setupLoadHandlers (index.es.js?be04:10310)
      at CornerstoneViewport._setupLoadHandlers (react-hot-loader.development.js?9cb3:714)
      at CornerstoneViewport._callee$ (index.es.js?be04:9825)
      at tryCatch (index.es.js?be04:194)
      at Generator.invoke [as _invoke] (index.es.js?be04:420)
      at Generator.prototype.&lt;computed&gt; [as next] (index.es.js?be04:246)
      at asyncGeneratorStep (index.es.js?be04:928)
      at _next (index.es.js?be04:950)
  </code></pre>
  <p>Does someone have a clue on what could be the problem?</p>