React 从一开始就被设计为逐步采用。你可以根据需要使用尽可能少或尽可能多的 React。无论你是想体验 React、向 HTML 页面添加一些交互性、还是启动复杂的 React 驱动的应用,本节都将帮助你入门。
¥React has been designed from the start for gradual adoption. You can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to an HTML page, or start a complex React-powered app, this section will help you get started.
在此章节中
尝试 React
¥Try React
你不需要安装任何东西来玩 React。尝试编辑这个沙盒!
¥You don’t need to install anything to play with React. Try editing this sandbox!
function Greeting({ name }) { return <h1>Hello, {name}</h1>; } export default function App() { return <Greeting name="world" /> }
你可以直接编辑它,也可以按右上角的 “复刻” 按钮在新选项卡中打开它。
¥You can edit it directly or open it in a new tab by pressing the “Fork” button in the upper right corner.
React 文档中的大多数页面都包含这样的沙箱。在 React 文档之外,还有许多支持 React 的在线沙箱:例如,CodeSandbox、StackBlitz 或 CodePen。
¥Most pages in the React documentation contain sandboxes like this. Outside of the React documentation, there are many online sandboxes that support React: for example, CodeSandbox, StackBlitz, or CodePen.
在本地尝试 React
¥Try React locally
要在你的计算机上本地尝试 React,下载此 HTML 页面。在你的编辑器和浏览器中打开它!
¥To try React locally on your computer, download this HTML page. Open it in your editor and in your browser!
开始一个新的 React 项目
¥Start a new React project
如果你想完全使用 React 构建应用或网站,开始一个新的 React 项目。
¥If you want to build an app or a website fully with React, start a new React project.
将 React 添加到现有项目
¥Add React to an existing project
如果想在你现有的应用或网站中尝试使用 React,将 React 添加到现有项目中。
¥If want to try using React in your existing app or a website, add React to an existing project.
下一步
¥Next steps
前往 快速开始 指南,了解你每天都会遇到的最重要的 React 概念。
¥Head to the Quick Start guide for a tour of the most important React concepts you will encounter every day.