0.6 Hello World with ES6 and JSX 使用ES6和JSX的Hello World

We recommend using a bundler like webpack or Browserify so you can write modular code and bundle it together into small packages to optimize load time.

我们建议使用像webpack或Browserify这样的打包器,以便您可以编写模块化代码,并将它们捆绑到小型软件包中以优化加载时间。

The smallest React example looks like this:

最小的React示例如下所示:

import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
   

hello, world!


   document.getElementById('root')
);

This code renders into a DOM element with the id of root so you need

somewhere in your HTML file.

这段代码被渲染到id为root的DOM元素中,是你的HTML文件需要一个

Similarly, you can render a React component inside a DOM element somewhere inside your existing app written with any other JavaScript UI library.

同样,你可以把一个React组件渲染到使用其他JavaScript UI库的现有应用的DOM内部中。

你可能感兴趣的:(0.6 Hello World with ES6 and JSX 使用ES6和JSX的Hello World)