T
T
tj572018-10-22 01:17:33
JavaScript
tj57, 2018-10-22 01:17:33

Why doesn't babel compile React code (error: unexpected token)?

I start babel, I try to compile the input file, I write an error in the console that it does not recognize the JSX object:
5bccfa0ecbdb9606409660.png
At the same time, the error appeared out of nowhere, I did not change the config, everything worked fine.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2018-10-22
@tj57

const jsx = uh, what, is that a curly brace?
No, it came from your ignorance and laziness. You should read at least something about jsx before you start writing code, so as not to embarrass yourself like this. Change brackets to round ones.

V
Vladimir, 2018-10-22
@Casufi

Why babel

https://babeljs.io/docs/en/babel-plugin-transform-...
Although I have not yet met people who babel jsx transpile
Usually this is used
https://github.com/facebook/create-react-app# npm-r...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question