I am injecting some javascript/sdk into my project via react-helmet
. It is successfully injecting the script and min.js link into the head, but I am unable to access any of the objects/functionality that the SDK
provides. If I only throw in a console log inside the Helmet
it will print out the log though. I am injecting the script on the App.tsx
level. If I paste the javascript directly into the head or body of the index
file everything works as expected, but I don’t want it to be there for security purposes.
My main question is it is successfully injecting the script in, but why can’t I access anything from it? It comes back as undefined
each time.
EDIT
I just did some additional debugging and I think the issue may be that the SDK isn’t fully loaded at the time I am calling it…
App file
<Authentication>
<Helmet>
<script type="text/javascript">
{`
//some complex javascript goes here
//some promise/async functions goes here too
`}
</script>
</Helmet>
</Authentication