The easiest way to get started with React is to use this Hello World example code on CodePen. You don't need to install anything; you can just open it in another tab and follow along as we go through examples. If you'd rather use a local development environment, check out the Installation page.
开始学习React最好的方法是使用我们在CodePen上的Hello World事例。你不需要安装任何东西。你只需要在新的标签页中打开它然后跟着我们给出的事例走。如果你希望使用本地开发环境,那就去看安装说明页。
The smallest React example looks like this:
最小的React事例长成这样:
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
It renders a header saying "Hello World" on the page.
它在页面的头部渲染了一个“Hello World”。
The next few sections will gradually introduce you to using React. We will examine the building blocks of React apps: elements and components. Once you master them, you can create complex apps from small reusable pieces.
下面的章节我们将指导你去使用React。我们会查看React应用的构建块:元素和组件。一旦你精通了,你就可以使用重复的小部件创建复杂的应用。