I am having issue in calling a 3rd party javascript in my react project.
I called like this in index.html file inside body tag
<body>
<script src="https://zwibbler.com/zwibbler-demo.js"></script>
</body
I also called the script in <head> tag but that also didn't work.
I am able to fetch and use it successfully in my fresh create-react-app, but when I integrate it to my existing react project, the script shows it loaded in network tab but does not render the output. What should I do to load it?
I also called script in componentDidMount as shown below, but that doesn't work:
componentDidMount() {
const script = document.createElement("script");
script.src = "https://zwibbler.com/zwibbler-demo.js";
document.body.appendChild(script);
}
The component in which I am using it (3rd party lib) comes after two or three routes later, means user has to do some action/events to get to render that component, so is it due to these event that i can not use the library? Or simply how do I call that script when the component loads? I have already tried componentWill/DidMount().
"https://zwibbler.com/zwibbler-demo.jsin index.js