Skip to content

Commit ae45995

Browse files
committed
translate first challenge
1 parent 192f938 commit ae45995

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/content/learn/preserving-and-resetting-state.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,9 +1264,9 @@ Hangi stratejiyi seçerseniz seçin, _Alice ile_ sohbet, _Bob ile_ sohbetten kav
12641264
12651265
<Challenges>
12661266
1267-
#### Fix disappearing input text {/*fix-disappearing-input-text*/}
1267+
#### Kaybolan input metnini düzeltin {/*fix-disappearing-input-text*/}
12681268
1269-
This example shows a message when you press the button. However, pressing the button also accidentally resets the input. Why does this happen? Fix it so that pressing the button does not reset the input text.
1269+
Bu örnek butona tıkladığınız zaman bir mesaj göstermektedir. Ancak, butona tıkalamak aynı zamanda input'u da sıfırlamaktadır. Sizce bu niye olmakta? Butona tıklamanın input metnini sıfırlamayacağı şekilde düzeltin.
12701270

12711271
<Sandpack>
12721272

@@ -1278,11 +1278,11 @@ export default function App() {
12781278
if (showHint) {
12791279
return (
12801280
<div>
1281-
<p><i>Hint: Your favorite city?</i></p>
1281+
<p><i>İpucu: Favori şehriniz?</i></p>
12821282
<Form />
12831283
<button onClick={() => {
12841284
setShowHint(false);
1285-
}}>Hide hint</button>
1285+
}}>İpucunu gizle</button>
12861286
</div>
12871287
);
12881288
}
@@ -1291,7 +1291,7 @@ export default function App() {
12911291
<Form />
12921292
<button onClick={() => {
12931293
setShowHint(true);
1294-
}}>Show hint</button>
1294+
}}>İpucunu göster</button>
12951295
</div>
12961296
);
12971297
}
@@ -1315,9 +1315,9 @@ textarea { display: block; margin: 10px 0; }
13151315

13161316
<Solution>
13171317

1318-
The problem is that `Form` is rendered in different positions. In the `if` branch, it is the second child of the `<div>`, but in the `else` branch, it is the first child. Therefore, the component type in each position changes. The first position changes between holding a `p` and a `Form`, while the second position changes between holding a `Form` and a `button`. React resets the state every time the component type changes.
1318+
Burdaki sorun `Form'un` farklı konumlarda render edilmesidir. `if` dalında `<div>`'in ikinci alt elemanıdır, ancak `else` dalında ilk alt elemanıdır. Bu nedenle, her konumdaki bileşen tipi değişir. Birinci konum `p` ve `Form` arasında değişirken, ikinci konum `Form` ve `button` arasında değişir. React, bileşen tipi her değiştiğinde state'i sıfırlar.
13191319

1320-
The easiest solution is to unify the branches so that `Form` always renders in the same position:
1320+
En kolay çözüm, `Form'un` her zaman aynı konumda render edilmesi için dalları birleştirmektir:
13211321

13221322
<Sandpack>
13231323

@@ -1329,17 +1329,17 @@ export default function App() {
13291329
return (
13301330
<div>
13311331
{showHint &&
1332-
<p><i>Hint: Your favorite city?</i></p>
1332+
<p><i>İpucu: Favori şehriniz?</i></p>
13331333
}
13341334
<Form />
13351335
{showHint ? (
13361336
<button onClick={() => {
13371337
setShowHint(false);
1338-
}}>Hide hint</button>
1338+
}}>İpucunu gizle</button>
13391339
) : (
13401340
<button onClick={() => {
13411341
setShowHint(true);
1342-
}}>Show hint</button>
1342+
}}>İpucunu göster</button>
13431343
)}
13441344
</div>
13451345
);
@@ -1363,7 +1363,7 @@ textarea { display: block; margin: 10px 0; }
13631363
</Sandpack>
13641364

13651365

1366-
Technically, you could also add `null` before `<Form />` in the `else` branch to match the `if` branch structure:
1366+
Teknik olarak, `if` dal yapısıyla eşleşmesi için `else` dalındaki `<Form />'dan` önce `null` ekleyebilirsiniz:
13671367

13681368
<Sandpack>
13691369

@@ -1375,11 +1375,11 @@ export default function App() {
13751375
if (showHint) {
13761376
return (
13771377
<div>
1378-
<p><i>Hint: Your favorite city?</i></p>
1378+
<p><i>İpucu: Favori şehriniz?</i></p>
13791379
<Form />
13801380
<button onClick={() => {
13811381
setShowHint(false);
1382-
}}>Hide hint</button>
1382+
}}>İpucunu gizle</button>
13831383
</div>
13841384
);
13851385
}
@@ -1389,7 +1389,7 @@ export default function App() {
13891389
<Form />
13901390
<button onClick={() => {
13911391
setShowHint(true);
1392-
}}>Show hint</button>
1392+
}}>İpucunu göster</button>
13931393
</div>
13941394
);
13951395
}
@@ -1411,7 +1411,7 @@ textarea { display: block; margin: 10px 0; }
14111411

14121412
</Sandpack>
14131413

1414-
This way, `Form` is always the second child, so it stays in the same position and keeps its state. But this approach is much less obvious and introduces a risk that someone else will remove that `null`.
1414+
Bu şekilde `Form` her zaman ikinci alt elemandır yani her zaman aynı konumdadır ve state'i korur. Ancak bu yaklaşım daha az belirgindir ve başka birinin bu `null'u` silmesi riskini beraberinde getirir.
14151415
14161416
</Solution>
14171417

0 commit comments

Comments
 (0)