Getting the error: Uncaught SyntaxError: Unexpected token '<'

Hi everyone,

I am using the react app to link a js file into html file by using the element:

<script type="text/javascript" src="../src/app.js"></script>

But it gives me the error: Uncaught SyntaxError: Unexpected token ‘<’

I can not figure out why this is causing an error. Does anyone know why the element is giving the error? I’d appreciate any help.

I’m going to guess it means you’re missing a closing symbol earlier in the code. A }, ], ), or >maybe?

That is what I thought first but the error goes away when I remove the script element.

I also created an empty app.js file in the same folder as the html file and it works fine. but whenever I use ../ to move up to parent folder and go into src folder where my actual app.js file is located I get the error.