0

i need to import an external script and it is giving me a lot of trouble.

what i want to do is use the following library: https://github.com/reymond-group/smilesDrawer

there is a getting started example but its in plain html. I can install the library but get the error "cannot import outside of module". I figured i can fix it by just importing the script in a script tag, as such:

in useEffect()

const scriptTag = document.createElement("script");
scriptTag.src = "https://unpkg.com/smiles-drawer@1.0.10/dist/smiles-drawer.min.js";
scriptTag.async = true;
document.body.appendChild(scriptTag);

and this works, can can see the script and access it in the browser through the console, however what i can not figure out is how to do that from REACT!!

thanks

david 11
  • 75
  • 8

0 Answers0