title: Onerror and onload events dont fire in script element in react
body: <p>i am trying to fetch a script from stripe dynamically inside my react component.
  Getting the script the</p>
  
  <pre><code>|script src="https://js.stripe.com/v3/"&gt;
  </code></pre>
  
  <p>type of way worked. However in react it seems that the onerror and onload
  events just don't fire.</p>
  
  <p><a href="https://codesandbox.io/s/nn4kk55rr0" rel="nofollow noreferrer">https://codesandbox.io/s/nn4kk55rr0</a></p>
  
  <p>or:</p>
  
  <pre><code>import React, { Component } from "react";
  import ReactDOM from "react-dom";
  
  class App extends Component {
    showLoad = () =&gt; {
      console.log("loaded");
    };
    showError = () =&gt; {
      console.log("error");
    };
    fetchStripe = () =&gt; {
      console.log("fetching");
      var stripe = document.createElement("script");
      stripe.onload = this.showLoad;
      stripe.onerror = this.showError;
      stripe.src = "https://js.stripe.com/v3/";
    };
    componentDidMount() {
      this.fetchStripe();
    }
    render() {
      return &lt;div className="App"&gt;Hallo&lt;/div&gt;;
    }
  }
  
  const rootElement = document.getElementById("root");
  ReactDOM.render(&lt;App /&gt;, rootElement);
  </code></pre>
  
  <p>Thanks for any help in advance!</p>