From ddf1c3cca3361cb76e55e9701190119c47afdf71 Mon Sep 17 00:00:00 2001 From: x-cold Date: Mon, 13 Dec 2021 00:49:46 +0800 Subject: [PATCH 01/39] feat: translate learn/index into Chinese --- beta/src/pages/learn/index.md | 175 +++++++++++++++++----------------- 1 file changed, 85 insertions(+), 90 deletions(-) diff --git a/beta/src/pages/learn/index.md b/beta/src/pages/learn/index.md index 0df815d1a6..0defa4addc 100644 --- a/beta/src/pages/learn/index.md +++ b/beta/src/pages/learn/index.md @@ -1,27 +1,27 @@ --- -title: Quick Start +title: 开始 --- -Welcome to the React documentation! Here is an overview of what you can find on this site. +欢迎阅读 React 文档! 此文档是您在本站点能找到的信息的概览。 -* [How to set up React](/learn/installation) -* [How to think about building user interfaces with React](/learn/thinking-in-react) -* [How to get something rendering on the screen](/learn/describing-the-ui) -* [How to make your user interface respond to interactions](/learn/adding-interactivity) -* [How to keep your logic maintainable as your app grows](/learn/managing-state) -* [How to step outside React when necessary](/learn/escape-hatches) +* [如何安装 React](/learn/installation) +* [如何思考用 React 构建用户界面](/learn/thinking-in-react) +* [如何在屏幕中渲染内容](/learn/describing-the-ui) +* [如何让您的用户界面响应交互](/learn/adding-interactivity) +* [随着您的应用的增长,如何保持逻辑的可维护性](/learn/managing-state) +* [必要时如何使用安全舱逃离 React](/learn/escape-hatches) -## Introduction {/*introduction*/} +## 介绍 -This is a tiny React app. To get your first taste of React, **edit the code below** and make it display your name: +这是一个最基本的 React 应用。用于让您第一次品尝 React,**编辑下面的代码** 然后让它显示您的名字: @@ -43,29 +43,29 @@ export default function App() { -### What is React? {/*what-is-react*/} +### React 是什么? -React is a JavaScript library for building user interfaces. +React 是一个用于构建用户界面的 JavaScript 库 -React stands at the intersection of design and programming. **It lets you take a complex user interface, and break it down into nestable and reusable pieces called ["components"](/learn/your-first-component) that fit well together.** If you have a programming background, this might remind you of making a program out of functions. If you're a designer, this might remind you of composing a design out of layers. If you're new to both disciplines, that's okay! Many people get into them with React. Using React might also remind you of building a castle out of toy bricks. Sometimes, it's even fun. +React 擅长交互设计和编程。**他让您创建复杂的用户界面,并且将其分解为[组件](/learn/your-first-component),指的是可嵌套和可重用的部分,可以很好的进行组合。** 如果您已经有编程的背景,这可能会让您想起用函数来编程。如果您是一名设计师,它可能会让您联想到图层组合设计。如果您对这两门学科都是新手,那也没关系。很多人会通过 React 去掌握他们。使用 React 也许还会让您想起用玩具砖块来建造城堡。有时候,他甚至非常有趣。 -React does not prescribe how you build your entire application. It helps you define and compose components, but stays out of your way in other questions. This means that you will either pick one of the ecosystem solutions for problems like routing, styling, and data fetching, or [use a framework](/learn/start-a-new-react-project#building-with-react-and-a-framework) that provides great defaults. +React 没有规定要如何构建整个应用程序。它能帮助您定义和组合组件,但在其他问题中不会妨碍您。这意味您可以选择一个生态系统解决方案来解决路由、样式和数据获取等问题,或者您也可以 [使用一个提供了很多内置功能的框架](/learn/start-a-new-react-project#building-with-react-and-a-framework) -### What can you do with React? {/*what-can-you-do-with-react*/} +### 您可以用 React 做什么? -Quite a lot, really! People use React to create all kinds of user interfaces--from small controls like buttons and dropdowns to entire apps. **These docs will teach you to use React on the web.** However, most of what you'll learn here applies equally for [React Native](https://reactnative.dev/) which lets you build apps for Android, iOS, and even [Windows and macOS](https://microsoft.github.io/react-native-windows/). +实际上,大量开发者们使用 React 来创建各种用户界面——从像按钮和下拉菜单这样的小控件到整个应用程序。 **这些文档将教您在网络上使用 React。** 然而,您在这里学到的大部分内容同样适用于 [React Native](https://reactnative.dev/),它可以让您为 Android、iOS,甚至 [Windows 和 macOS](https://microsoft.github.io/react-native-windows/) 构建应用程序。 -If you're curious which products you use everyday are built with React, you can install the [React Developer Tools](/learn/react-developer-tools). Whenever you visit an app or a website built with React (like this one!), its icon will light up in the toolbar. +如果您好奇您日常使用的哪些产品是用 React 构建的,您可以安装 [React Developer Tools](/learn/react-developer-tools)。 每当您访问使用 React 构建的应用程序或网站时(就像这个文档网站!),它的图标会在工具栏中亮起。 -### React uses JavaScript {/*react-uses-javascript*/} +### React 使用 JavaScript -With React, you will describe your visual logic in JavaScript. This takes some practice. If you're learning JavaScript and React at the same time, you're not alone--but at times, it will be a little bit more challenging! On the upside, **much of learning React is really learning JavaScript,** which means you will take your learnings far beyond React. +使用 React,您将在 JavaScript 中可视化地描述您的逻辑。这需要一些练习。如果您同时学习 JavaScript 和 React,很多人都这么干,但有时,它会更具挑战性! 从好的方面来说,**大部分学习 React 都是在学习 JavaScript,** 这意味着您将学到的东西远远超出 React。 -Check your knowledge level with [this JavaScript overview](https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript). It will take you between 30 minutes and an hour but you will feel more confident learning React. [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) and [javascript.info](https://javascript.info/) are two great resources to use as a reference. +使用 [此 JavaScript 概述](https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript) 检查您的知识水平。这将花费您 30 分钟到一个小时,但您会更有信心学习 React。 [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) 和 [javascript.info](https://javascript.info/) 是两个很好的参考资源。 - + -If you're just starting to learn React, you don't need to install anything. Instead, we recommend to follow along using the interactive sandboxes that appear throughout this site. They look like this: +如果您刚开始学习 React,您不需要安装任何东西。相反,我们建议您继续使用本网站中出现的 CodeSandbox。 它们看起来像这样: @@ -81,23 +81,23 @@ export default function App() { -When you're ready to start a project, there are several options. You can write React code online and save your work in an environment like [CodeSandbox](https://react.new/). You can add React as a `