How To Add an External .js script


#1

Hello I wanted to add an external javascript .js script.
I added it to a component ‘Screen’ -> State -> ‘Edit Script’

Using the following code:

var script = document.createElement(‘script’);
script.src = ‘http://localhost:4000/Built.js’;
var head = document.getElementsByTagName(“head”)[0];
head.appendChild(script);

But the .js file loads and executes its code multiple times.

Is there an easier way to do this?


#2

Hello. How to add external script and use it in React Studio? I get ‘undefined error’ even though i can call a function from the ‘Browser console command line’


#3

Hi, currently there is no way for adding external javascript files but we’re going to make few tests and let you know if we find a generic solution for this.