title: Access React DOM Element from external script
body: <p>I am trying to get access to a React DOM element 'id' from an external script file. I believe my script is being imported correctly as console.log('test') from the file is working, though console.log(myDiv) returns null.</p>
  
  <p>How can I achieve this in React?</p>
  
  <p>// COMPONENT  </p>
  
  <pre><code>import './../data/script.ts';
  
    render() {
      return (
          &lt;div id='targetDiv'&gt;
            &lt;p&gt;{This will be populated from my external script file...}&lt;/p&gt;
          &lt;/div&gt;
      );
    }
  </code></pre>
  
  <p>// SCRIPT</p>
  
  <pre><code>  var myDiv = document.getElementById('targetDiv');
    console.log(myDiv);
  </code></pre>