I am using an external js file inside a helmet tag within my reactjs application
import {Helmet} from "react-helmet";
...
<Helmet>
<meta charSet="utf-8" />
<title>My Title</title>
<link rel="canonical" href="http://example.com/example" />
<script src="https://unpkg.com/vue" type="text/javascript" />
<script src="assets/my-app.js" type="text/javascript" />
</Helmet>
But the problem that I see in chrome logs, it can not read the js file correctly and gives me
Uncaught SyntaxError: Unexpected token < on
I am not sure where to put the java script external file inside my react app so it is regarded as the java script external file?
EDIT:
Based on response below, I am using now localhost:3000/my-app.js, but is there any variable to use instead?
question from:
https://stackoverflow.com/questions/65625739/using-external-java-scripts-inside-reactjs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…