L
L
Leopandro2018-11-23 18:36:26
React
Leopandro, 2018-11-23 18:36:26

How to write in jsx?

write in js file

ReactDOM.render(
  <h1>Hello, world!</h1>,
  document.getElementById('root')
);

it says
Uncaught SyntaxError: Unexpected token <
I use react along with yii2 framework.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-11-23
@Leopandro

The code must be translated into JS before execution.
babel-preset-react

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question