Skip to content

Commit 8cd4161

Browse files
committed
Translate globals lint rule
1 parent 37a7f80 commit 8cd4161

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • src/content/reference/eslint-plugin-react-hooks/lints

‎src/content/reference/eslint-plugin-react-hooks/lints/globals.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ title: globals
44

55
<Intro>
66

7-
Validates against assignment/mutation of globals during render, part of ensuring that [side effects must run outside of render](/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render).
7+
レンダー中にグローバル変数への代入・書き換えを行っていないか検証します。これは、[副作用はレンダーの外で実行しなければならない](/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render)というルールを守るためのチェックの一部です。
88

99
</Intro>
1010

11-
## Rule Details {/*rule-details*/}
11+
## ルールの詳細 {/*rule-details*/}
1212

13-
Global variables exist outside React's control. When you modify them during render, you break React's assumption that rendering is pure. This can cause components to behave differently in development vs production, break Fast Refresh, and make your app impossible to optimize with features like React Compiler.
13+
グローバル変数は、React の管理外にあります。レンダー中に書き換えを行うと、レンダーは純粋であるべきという React の前提に反します。これにより、開発環境と本番環境でコンポーネントの動作が異なったり、Fast Refresh が動作しなくなったり、React Compiler などの機能によるアプリの最適化ができなくなったりする可能性があります。
1414

15-
### Invalid {/*invalid*/}
15+
### 無効な例 {/*invalid*/}
1616

17-
Examples of incorrect code for this rule:
17+
このルールに違反するコードの例です。
1818

1919
```js
2020
// ❌ Global counter
@@ -47,9 +47,9 @@ function Component({id}) {
4747
}
4848
```
4949

50-
### Valid {/*valid*/}
50+
### 有効な例 {/*valid*/}
5151

52-
Examples of correct code for this rule:
52+
このルールに従ったコードの例です。
5353

5454
```js
5555
// ✅ Use state for counters

0 commit comments

Comments
 (0)