Skip to content

Commit 2e9ac00

Browse files
docs(cn): translate reference/rules/components-and-hooks-must-be-pure.md into Chinese
优化翻译
1 parent 774265a commit 2e9ac00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/reference/rules/components-and-hooks-must-be-pure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function Dropdown() {
4949
function Dropdown() {
5050
const selectedItems = new Set();
5151
const onSelect = (item) => {
52-
// 这段代码位于事件处理器中,因此只有在用户触发这个事件时才会运行。
52+
// 这段代码位于事件处理函数中,因此只有在用户触发这个事件时才会运行。
5353
selectedItems.add(item);
5454
}
5555
}
@@ -99,7 +99,7 @@ function useTime() {
9999
useEffect(() => {
100100
// 2. 使用 `setInterval` 每秒更新当前日期。
101101
const id = setInterval(() => {
102-
setTime(new Date()); //Good:非幂等代码不再在渲染中运行。
102+
setTime(new Date()); //正确的:非幂等代码不再在渲染中运行。
103103
}, 1000);
104104
// 3. 返回一个清理函数,这样我们就不会忘记清理 `setInterval` 定时器,导致内存泄漏。
105105
return () => clearInterval(id);

0 commit comments

Comments
 (0)