首先标题是假命题。

react作为一个UI库是不需要babel的,使用的原因是因为jsx的语法问题。使用jsx语法可以使React的书写更简单、优雅。

jsx

class HelloWorld extends React.Component {    
    render() {
        return (
            <h1>Hello World</h1>
        );
    }  
}

js

class HelloWorld extends React.Component {
  render() {
    return (
      React.createElement(
        'h1',
        {className: 'large'},
        'Hello World'
      )
    );
  }
}

草帽_小子
9 声望0 粉丝