`) has to line up. Otherwise, toggling `isActive` would recreate the whole tree below and [reset its state.](/learn/preserving-and-resetting-state) This is why, if a similar JSX tree gets returned in both cases, it is better to write them as a single piece of JSX.
+異なる 2 つの JSX の塊が同じツリーを記述する場合、それらのネスト(最初の `
` → 最初の `
![]()
`)は一致する必要があることに留意してください。そうでなければ、`isActive` を切り替えると、下のツリー全体が再作成され、[state がリセット](/learn/preserving-and-resetting-state)されてしまいます。このため、同じような JSX ツリーが両方のケースで返される場合は、1つの JSX として記述する方が良いでしょう。
-#### Profile editor {/*profile-editor*/}
+#### プロフィールエディタ {/*profile-editor*/}
-Here is a small form implemented with plain JavaScript and DOM. Play with it to understand its behavior:
+以下は、プレーンな JavaScript と DOM で実装した小さなフォームです。このフォームをいじってみて、その動作を理解してください。
@@ -800,11 +800,11 @@ label { display: block; margin-bottom: 20px; }
-This form switches between two modes: in the editing mode, you see the inputs, and in the viewing mode, you only see the result. The button label changes between "Edit" and "Save" depending on the mode you're in. When you change the inputs, the welcome message at the bottom updates in real time.
+このフォームは、編集モードでは入力フィールド、閲覧モードでは入力結果のみが表示される、というように 2 つのモードを切り替えて動作します。ボタンのラベルは、モードによって "Edit" と "Save" が切り替わります。入力内容を変更すると、下部のウェルカムメッセージがリアルタイムで更新されます。
-Your task is to reimplement it in React in the sandbox below. For your convenience, the markup was already converted to JSX, but you'll need to make it show and hide the inputs like the original does.
+あなたのタスクは、これを以下のサンドボックス内で React で再実装することです。作業しやすいようにマークアップはすでに JSX に変換されていますが、元のコードと同様に入力フィールドの表示と非表示を行う必要があります。
-Make sure that it updates the text at the bottom, too!
+また、下部のテキストもちゃんと更新されるようにしてください!
@@ -839,9 +839,9 @@ label { display: block; margin-bottom: 20px; }
-You will need two state variables to hold the input values: `firstName` and `lastName`. You're also going to need an `isEditing` state variable that holds whether to display the inputs or not. You should _not_ need a `fullName` variable because the full name can always be calculated from the `firstName` and the `lastName`.
+入力値を保持するために `firstName` と `lastName` の 2 つの state 変数が必要になります。また、入力フィールドを表示するかどうかを管理する `isEditing` state 変数も必要になります。`fullName` 変数は必要*ありません*。なぜなら、フルネームは常に `firstName` と `lastName` から計算できるからです。
-Finally, you should use [conditional rendering](/learn/conditional-rendering) to show or hide the inputs depending on `isEditing`.
+最後に、[条件付きレンダー](/learn/conditional-rendering)を使用して、`isEditing` に応じて入力フィールドを表示したり非表示にしたりする必要があります。
@@ -899,13 +899,13 @@ label { display: block; margin-bottom: 20px; }
-Compare this solution to the original imperative code. How are they different?
+この解決策と元の命令型のコードを比較してみてください。どう違うでしょうか?
-#### Refactor the imperative solution without React {/*refactor-the-imperative-solution-without-react*/}
+#### React を使わない命令型コードのリファクタリング {/*refactor-the-imperative-solution-without-react*/}
-Here is the original sandbox from the previous challenge, written imperatively without React:
+こちらはひとつ前のチャレンジで、React を使わずに命令的に記述されたオリジナルのサンドボックスです。
@@ -1002,9 +1002,9 @@ label { display: block; margin-bottom: 20px; }
-Imagine React didn't exist. Can you refactor this code in a way that makes the logic less fragile and more similar to the React version? What would it look like if the state was explicit, like in React?
+React が存在しなかったと想像してください。このコードをリファクタリングして、ロジックを壊れにくくし、React のバージョンに近づけることはできるでしょうか? React のように state が明示的であれば、どのように見えるでしょうか?
-If you're struggling to think where to start, the stub below already has most of the structure in place. If you start here, fill in the missing logic in the `updateDOM` function. (Refer to the original code where needed.)
+何から手をつければいいのか悩んでいる人は、下のスタブですでにほとんどの構造ができています。ここから始める場合は、`updateDOM` 関数で足りないロジックを埋めてください。(必要に応じて元のコードを参照してください。)
@@ -1111,7 +1111,7 @@ label { display: block; margin-bottom: 20px; }
-The missing logic included toggling the display of inputs and content, and updating the labels:
+足りないロジックは、入力フィールドとコンテンツの表示の切り替え、ラベルの更新などでした。
@@ -1228,7 +1228,7 @@ label { display: block; margin-bottom: 20px; }
-The `updateDOM` function you wrote shows what React does under the hood when you set the state. (However, React also avoids touching the DOM for properties that have not changed since the last time they were set.)
+あなたが書いた `updateDOM` 関数は、state を設定したときに React が水面下で何をするのかを示しています。(ただし、React は前回設定したときから変化していないプロパティについては DOM に触れないようにもしています。)
diff --git a/src/sidebarLearn.json b/src/sidebarLearn.json
index 13aef4415..2fecd3ac4 100644
--- a/src/sidebarLearn.json
+++ b/src/sidebarLearn.json
@@ -126,7 +126,7 @@
"tags": ["intermediate"],
"routes": [
{
- "title": "Reacting to Input with State",
+ "title": "state を使って入力に反応する",
"path": "/learn/reacting-to-input-with-state"
},
{