From 49cffca0c919c5304b6ea6b4f5a5dbb8ce879a67 Mon Sep 17 00:00:00 2001 From: wenmin92 Date: Thu, 28 Oct 2021 15:36:24 +0800 Subject: [PATCH 1/4] [beta] docs(cn): translate content/learn/adding-interactivity.md into Chinese Co-Authored-By: QiChang Li --- .../src/content/learn/adding-interactivity.md | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/beta/src/content/learn/adding-interactivity.md b/beta/src/content/learn/adding-interactivity.md index 08d20551e1..1a7dfa683b 100644 --- a/beta/src/content/learn/adding-interactivity.md +++ b/beta/src/content/learn/adding-interactivity.md @@ -1,30 +1,30 @@ --- -title: Adding Interactivity +title: 添加交互 --- -Some things on the screen update in response to user input. For example, clicking an image gallery switches the active image. In React, data that changes over time is called *state.* You can add state to any component, and update it as needed. In this chapter, you'll learn how to write components that handle interactions, update their state, and display different output over time. +界面上的控件会根据用户的输入而更新。例如,点击按钮切换轮播图的展示。在 React 中,随时间变化的数据被称为状态(state)。你可以向任何组件添加状态,并按需进行更新。在本章节中,你将学习如何编写处理交互的组件,更新它们的状态,并根据时间变化展示显示不同的效果。 -* [How to handle user-initiated events](/learn/responding-to-events) -* [How to make components "remember" information with state](/learn/state-a-components-memory) -* [How React updates the UI in two phases](/learn/render-and-commit) -* [Why state doesn't update right after you change it](/learn/state-as-a-snapshot) -* [How to queue multiple state updates](/learn/queueing-a-series-of-state-updates) -* [How to update an object in state](/learn/updating-objects-in-state) -* [How to update an array in state](/learn/updating-arrays-in-state) +* [如何处理用户发起的事件](/learn/responding-to-events) +* [如何用状态使组件“记住”信息](/learn/state-a-components-memory) +* [React 是如何分两个阶段更新 UI 的](/learn/render-and-commit) +* [为什么状态在你改变后没有立即更新](/learn/state-as-a-snapshot) +* [如何排队进行多个状态的更新](/learn/queueing-a-series-of-state-updates) +* [如何更新状态中的对象](/learn/updating-objects-in-state) +* [如何更新状态中的数组](/learn/updating-arrays-in-state) -## Responding to events {/*responding-to-events*/} +## 响应事件 {#responding-to-events} -React lets you add *event handlers* to your JSX. Event handlers are your own functions that will be triggered in response to user interactions like clicking, hovering, focusing on form inputs, and so on. +React 允许你向 JSX 中添加事件处理程序。事件处理程序是你自己的函数,它将在用户交互时被触发,如点击、悬停、焦点在表单输入框上等等。 -Built-in components like `