I am trying to call a normal javascript function inside of a react component function.
The script tags are nested in the footer as following :
<script src="NORMAL JAVASCRIPT STUFF"></script> // function test(){};
<script src="REACT STUFF"></script>
So the javascript file with the function that I need is being read earlier. So the function should be available in the whole document.
Now when I try to call the function within some react component function like that:
....,
someFunction: function(){
test();
},...
I get Uncaught ReferenceError: test is not defined
Does anyone know how to access normal functions inside of react?
That function would belong to the window
object, so you would need to call window.test();
instead.
See here:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments