G
G
GoNext2020-01-23 21:33:39
JavaScript
GoNext, 2020-01-23 21:33:39

Connecting external js file to create-react-app?

Hello, such a question, I need to connect an external js file to my react project, I tried it via index.html, it gives an error Uncaught SyntaxError: Unexpected token '<',

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vann Damm, 2020-01-23
@GoNext

If you collect as a collector, then you can’t insert inline (not exactly).

A
Aetae, 2020-01-24
@Aetae

Uncaught SyntaxError: Unexpected token '<',says that instead of a script, html is loaded for you.
Most likely the path to the script is wrong.
For example, the path is relative and the project is not at the root or the history api is used: in this case, the paths in the application are resolved by the router, and the hard-wired script suffers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question