1componentDidMount() {
2 const script = document.createElement("script");
3 script.async = true;
4 script.src = "https://some-scripturl.js";
5 script.onload = () => this.scriptLoaded();
6
7
8
9 //For head
10 document.head.appendChild(script);
11
12 // For body
13 document.body.appendChild(script);
14
15 // For component
16 this.div.appendChild(script);
17
18 }
19