Skip to content

Commit ba017f1

Browse files
committed
Translate immutability lint rule
1 parent 37a7f80 commit ba017f1

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

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

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

55
<Intro>
66

7-
Validates against mutating props, state, and other values that [are immutable](/reference/rules/components-and-hooks-must-be-pure#props-and-state-are-immutable).
7+
props や state、その他の[イミュータブルな値](/reference/rules/components-and-hooks-must-be-pure#props-and-state-are-immutable)を書き換えていないか検証します。
88

99
</Intro>
1010

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

13-
A component’s props and state are immutable snapshots. Never mutate them directly. Instead, pass new props down, and use the setter function from `useState`.
13+
コンポーネントの props と state は、イミュータブルなスナップショットです。直接書き換えてはいけません。代わりに、新しい props を渡したり、`useState` のセッタ関数を使ったりしてください。
1414

15-
## Common Violations {/*common-violations*/}
15+
## よくある違反 {/*common-violations*/}
1616

17-
### Invalid {/*invalid*/}
17+
### 無効な例 {/*invalid*/}
1818

1919
```js
2020
// ❌ Array push mutation
@@ -47,7 +47,7 @@ function Component() {
4747
}
4848
```
4949

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

5252
```js
5353
// ✅ Create new array
@@ -69,11 +69,11 @@ function Component() {
6969
}
7070
```
7171

72-
## Troubleshooting {/*troubleshooting*/}
72+
## トラブルシューティング {/*troubleshooting*/}
7373

74-
### I need to add items to an array {/*add-items-array*/}
74+
### 配列に要素を追加したい {/*add-items-array*/}
7575

76-
Mutating arrays with methods like `push()` won't trigger re-renders:
76+
以下のように `push()` などのメソッドで配列を書き換えても、再レンダーは起きません。
7777

7878
```js
7979
// ❌ Wrong: Mutating the array
@@ -93,7 +93,7 @@ function TodoList() {
9393
}
9494
```
9595

96-
Create a new array instead:
96+
代わりに、新しい配列を作成してください。
9797

9898
```js
9999
// ✅ Better: Create a new array
@@ -113,9 +113,9 @@ function TodoList() {
113113
}
114114
```
115115

116-
### I need to update nested objects {/*update-nested-objects*/}
116+
### ネストされたオブジェクトを更新したい {/*update-nested-objects*/}
117117

118-
Mutating nested properties doesn't trigger re-renders:
118+
以下のようにネストされたプロパティを書き換えても、再レンダーは起きません。
119119

120120
```js
121121
// ❌ Wrong: Mutating nested object
@@ -135,7 +135,7 @@ function UserProfile() {
135135
}
136136
```
137137

138-
Spread at each level that needs updating:
138+
更新が必要な各階層で、スプレッド構文を使ってください。
139139

140140
```js
141141
// ✅ Better: Create new objects at each level

0 commit comments

Comments
 (0)