Module 01 · Introduction to React and Class ComponentsReact 与类组件简介
Lesson 2 Summary: Introduction to Class Components第 2 课总结:类组件简介
Congratulations! You have completed this lesson. At this point in the course, you know that:
恭喜!你已经完成了这个课程。在这个课程阶段,你知道:
- React components enable you to break up the user interface into separate parts that can be reused and handled independently.
组件化使您能够将用户界面拆分为可重用和独立处理的各个部分。 - The four types of React components are functional, class, pure, and high-order components.
四种 React 组件类型是函数式组件、类组件、纯组件和高阶组件。 - A class component in React is a JavaScript class that extends the React Component class from the React library.
一个 React 类组件是扩展自 React 库中的 React Component 类的 JavaScript 类。 - Class components manage state, handle lifecycle events, and define component methods.
组件类管理状态、处理生命周期事件以及定义组件方法。 - In React, props, or properties, send data from a parent component to a child component.
在 React 中,属性或特性,用于将数据从父组件发送到子组件。 - Event handling is the process of responding to user interactions, such as clicks, mouseovers, mouseouts, form submissions, and so on, within a React application.
事件处理是在 React 应用程序中响应用户交互的过程,例如点击、鼠标悬停、鼠标移出、表单提交等。 - State is a plain JavaScript object that React uses to represent information about the component’s current situation.
状态是一个 React 用来表示组件当前情况信息的纯 JavaScript 对象。 - Any changes in the state data cause the re-rendering of the component to reflect the change.
任何状态数据的变更都会导致组件重新渲染以反映该变更。 - Components can create and manage their data with states, whereas they receive data from outside with props.
组件可以使用状态创建和管理自己的数据,而它们从外部接收数据则是通过 props。 - The lifecycle of each React component encompasses three key phases: Mounting, updating, and unmounting.
每个 React 组件的生命周期包括三个关键阶段:挂载、更新和卸载。 - In component lifecycle, components are created or mounted on the DOM, they grow by updating, and then die or are unmounted on the DOM.
在组件生命周期中,组件被创建或挂载到 DOM 上,通过更新而成长,然后死亡或从 DOM 上卸载。