R
R
Riman2018-03-19 13:52:27
React
Riman, 2018-03-19 13:52:27

How does babel work?

There is jsx in the document, at what point in document parsing does babel come into play? What exactly does it do (basic steps), before which next browser action does babel end?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2018-03-19
@riman0612

The render code of your react component should look like this

class HelloMessage extends React.Component {
  render() {
    return React.createElement(
      "div",
      null,
      "Hello ",
      this.props.name
    );
  }
}

Babel from JSX turns this into what is above. At what stage? I think at the stage of formation of the bundle.
Documentation JSX->JS

R
Roman Aleksandrovich, 2018-03-19
@RomReed

https://learn.javascript.ru/es-modern-usage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question