I am trying to append a script tag to the head using React Component. From inspecting I see that the script tag has been added to the head but the content is not loaded on the page.
My code is:
export class TestComponent extends React.PureComponent<any, { loaded: boolean }> {
   state = { loaded: false };
   componentDidMount() {
      var s = document.createElement("script");
      s.async = true;
      s.src = "https://someurl/somejsfile.js";
      document.head.appendChild(s);
      s.onload = () => {
         this.state.loaded = true;
         console.log(s);
      };
   }
   render() {
      return null;
   }
}
This script tag adds a banner to the home page.
 
    