title: Render script tag in React Component
body: <p>I'm making a React application and I need to run a <code>Javascript</code> script only in one component, making reference to one of the <code>div</code>'s.</p>
  
  <p>I know there are some libraries to do so, but I wonder if there's a more direct way to do it. Right now I do this:</p>
  
  <pre><code>import React, { Component } from "react";
  import "../ThisComponent.css";
  
  export default class MyComponent extends Component {
    render() {
      return (
        &lt;div&gt;
          &lt;div id="scriptTarget" /&gt;
          &lt;div className="main"&gt;
            // Other stuff
          &lt;/div&gt;
          &lt;script src="js/myScript.js" /&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>But nothing happens. The script is stored in <code>public/js/myScript.js</code>.<br>
  Thanks!</p>