Skip to content

Commit

Permalink
docs(en): merge reactjs.org/main into zh-hans.reactjs.org/main @ 2390627
Browse files Browse the repository at this point in the history
  • Loading branch information
Yucohny authored Sep 24, 2023
2 parents 7685174 + 8cd26af commit e8705fc
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/components/Layout/Toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export function Toc({headings}: {headings: Toc}) {
<ul className="space-y-2 pb-16">
{headings.length > 0 &&
headings.map((h, i) => {
if (h.url == null) {
// TODO: only log in DEV
if (!h.url && process.env.NODE_ENV === 'development') {
console.error('Heading does not have URL');
}
return (
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/passing-props-to-a-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export default function Gallery() {
</li>
<li>
<b>Discovered: </b>
polonium (element)
polonium (chemical element)
</li>
</ul>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/removing-effect-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ function ChatRoom() {

useEffect(() => {
const options = createOptions();
const connection = createConnection();
const connection = createConnection(options);
connection.connect();
return () => connection.disconnect();
}, []); // ✅ 所有依赖已声明
Expand Down
2 changes: 0 additions & 2 deletions src/content/learn/state-a-components-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -1494,8 +1494,6 @@ export default function FeedbackForm() {
<Sandpack>

```js
import { useState } from 'react';

export default function FeedbackForm() {
function handleClick() {
const name = prompt('What is your name?');
Expand Down
4 changes: 2 additions & 2 deletions src/content/learn/state-as-a-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ label, textarea { margin-bottom: 10px; display: block; }
当 React 重新渲染一个组件时:

1. React 会再次调用你的函数
2. 你的函数会返回新的 JSX 快照
3. React 会更新界面来匹配你返回的快照
2. 函数会返回新的 JSX 快照
3. React 会更新界面以匹配返回的快照

<IllustrationBlock title="重新渲染" sequential>
<Illustration caption="React 执行函数" src="/images/docs/illustrations/i_render1.png" />
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/synchronizing-with-effects.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ useEffect(() => {
}
```
**这个例子说明如果重新挂载破坏了程序的逻辑,则通常含有未被发现的错误**。从用户的角度来看,访问这个页面的效果,与访问该页面时单击和页面中其他链接并按下后退没有什么不同。React 通过在开发环境中重复挂载组件来验证组件是否遵守此原则
**这个例子说明如果重新挂载破坏了应用程序的逻辑,则通常含有未被发现的错误**。从用户的角度来看,访问一个页面不应该与访问它、点击链接然后按下返回键再次查看页面有什么不同。React 通过在开发环境中重复挂载组件以验证组件是否遵守此原则
## 总结 {/*putting-it-all-together*/}
Expand Down
6 changes: 3 additions & 3 deletions src/content/reference/react-dom/components/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ title: "普通组件(例如 <div>)"
* `onFocusCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events)时触发的 `onFocus` 版本。
* [`onGotPointerCapture`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/gotpointercapture_event):一个 [`PointerEvent` 事件处理函数](#pointerevent-handler)。当元素以编程方式捕获指针时触发。
* `onGotPointerCaptureCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events) 触发的 `onGotPointerCapture` 版本。
* [`onKeyDown`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keydown_event):一个 [`KeyboardEvent` 事件处理函数](#pointerevent-handler)。当按键被按下时触发。
* [`onKeyDown`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keydown_event):一个 [`KeyboardEvent` 事件处理函数](#keyboardevent-handler)。当按键被按下时触发。
* `onKeyDownCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events) 触发的 `onKeyDown` 版本。
* [`onKeyPress`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keypress_event):一个 [`KeyboardEvent` 事件处理函数](#pointerevent-handler)。此属性已废弃,请使用 `onKeyDown``onBeforeInput` 替代。
* [`onKeyPress`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keypress_event):一个 [`KeyboardEvent` 事件处理函数](#keyboardevent-handler)。此属性已废弃,请使用 `onKeyDown``onBeforeInput` 替代。
* `onKeyPressCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events) 触发的 `onKeyPress` 版本。
* [`onKeyUp`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keyup_event):一个 [`KeyboardEvent` 事件处理函数](#pointerevent-handler)。当按键被释放时触发。
* [`onKeyUp`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/keyup_event):一个 [`KeyboardEvent` 事件处理函数](#keyboardevent-handler)。当按键被释放时触发。
* `onKeyUpCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events) 触发的 `onKeyUp` 版本。
* [`onLostPointerCapture`](https://developer.mozilla.org/zh-CN/docs/Web/API/Element/lostpointercapture_event):一个 [`PointerEvent` 事件处理函数](#pointerevent-handler)。当元素停止捕获指针时触发。
* `onLostPointerCaptureCapture`:一个在 [捕获阶段](/learn/responding-to-events#capture-phase-events) 触发的 `onLostPointerCapture` 版本。
Expand Down

0 comments on commit e8705fc

Please sign in to comment.