From e670dc2b57000a17d955ca12760988089f33b231 Mon Sep 17 00:00:00 2001 From: itsba2 Date: Wed, 26 Apr 2023 16:49:35 +0300 Subject: [PATCH 1/5] translate reacting-to-input-with-state --- .../learn/reacting-to-input-with-state.md | 400 +++++++++--------- src/sidebarLearn.json | 2 +- 2 files changed, 201 insertions(+), 201 deletions(-) diff --git a/src/content/learn/reacting-to-input-with-state.md b/src/content/learn/reacting-to-input-with-state.md index 522aa63a1..36ed4d555 100644 --- a/src/content/learn/reacting-to-input-with-state.md +++ b/src/content/learn/reacting-to-input-with-state.md @@ -1,37 +1,37 @@ --- -title: Reacting to Input with State +title: Girdiye State ile Reaksiyon Verme --- -React provides a declarative way to manipulate the UI. Instead of manipulating individual pieces of the UI directly, you describe the different states that your component can be in, and switch between them in response to the user input. This is similar to how designers think about the UI. +React, UI'ı manipüle etmek için bildirimsel bir yol sağlar. UI'ın her bir parçasını doğrudan manipüle etmek yerine, bileşeninizin içinde bulunabileceği farklı durumları (state'leri) tanımlar ve kullanıcı girdisine karşılık bunlar arasında geçiş yaparsınız. Bu, tasarımcıların UI hakkındaki düşüncelerine benzer. -* How declarative UI programming differs from imperative UI programming -* How to enumerate the different visual states your component can be in -* How to trigger the changes between the different visual states from code +* Bildirimsel UI programlamanın, zorunlu UI programlamadan nasıl ayrıştığını +* Bileşeninizin içinde bulunabileceği farklı görsel state'lerin nasıl sıralanabileceğini +* Farklı görsel state'ler arasındaki değişimin koddan nasıl tetiklenebileceğini -## How declarative UI compares to imperative {/*how-declarative-ui-compares-to-imperative*/} +## Bildirimsel ve zorunlu UI'ın karşılaştırması {/*how-declarative-ui-compares-to-imperative*/} -When you design UI interactions, you probably think about how the UI *changes* in response to user actions. Consider a form that lets the user submit an answer: +UI etkileşimleri tasarlarken, UI'ın kullanıcı aksiyonlarına karşılık nasıl *değiştiği* hakkında muhtemelen düşünürsünüz. Kullanıcının bir cevap gönderdiği bir form düşünelim: -* When you type something into the form, the "Submit" button **becomes enabled.** -* When you press "Submit", both the form and the button **become disabled,** and a spinner **appears.** -* If the network request succeeds, the form **gets hidden,** and the "Thank you" message **appears.** -* If the network request fails, an error message **appears,** and the form **becomes enabled** again. +* Formun içine bir şey yazdığınızda, "Gönder" butonu **etkinleşir.** +* "Gönder" butonuna bastığınızda, hem form hem de buton **devre dışı kalır** ve bir spinner **görünür.** +* Eğer ağ isteği başarılı olursa, form **görünmez hale gelir** ve "Teşekkürler" mesajı **görünür.** +* Eğer ağ isteği başarısız olursa, bir hata mesajı **görünür** ve form tekrar **etkinleşir.** -In **imperative programming,** the above corresponds directly to how you implement interaction. You have to write the exact instructions to manipulate the UI depending on what just happened. Here's another way to think about this: imagine riding next to someone in a car and telling them turn by turn where to go. +**Zorunlu programlama**da yukarıdakiler, etkileşimi nasıl uyguladığınıza doğrudan karşılık gelir. Az önce ne olduğuna bağlı olarak UI'ı manipüle etmek için tam talimatları yazmanız gerekir. Bunu düşünmenin başka bir yolu da şudur: Arabada birinin yanına bindiğinizi ve ona adım adım nereye gideceğini söylediğinizi hayal edin. - + -They don't know where you want to go, they just follow your commands. (And if you get the directions wrong, you end up in the wrong place!) It's called *imperative* because you have to "command" each element, from the spinner to the button, telling the computer *how* to update the UI. +Nereye gitmek istediğinizi bilmiyor, sadece talimatlarınızı takip ediyor. (Ve eğer yanlış yönlendirirseniz, kendinizi yanlış yerde bulursunuz!) Buna *zorunlu* denir çünkü, bilgisayara UI'yı *nasıl* güncellemesi gerektiğini, spinner'dan butona her eleman için "talimat vermeniz" gerekir. -In this example of imperative UI programming, the form is built *without* React. It only uses the browser [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model): +Zorunlu UI programlamanın bu örneğinde form, React *kullanmadan* oluşturulmuştur. Sadece tarayıcı [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model)'unu kullanır: @@ -81,13 +81,13 @@ function disable(el) { } function submitForm(answer) { - // Pretend it's hitting the network. + // Ağa istek atıyormuş gibi yapalım. return new Promise((resolve, reject) => { setTimeout(() => { if (answer.toLowerCase() == 'istanbul') { resolve(); } else { - reject(new Error('Good guess but a wrong answer. Try again!')); + reject(new Error('İyi tahmin ama yanlış cevap. Tekrar dene!')); } }, 1500); }); @@ -111,17 +111,17 @@ textarea.oninput = handleTextareaChange; ```html public/index.html
-

City quiz

+

Şehir sorusu

- What city is located on two continents? + İki kıta üzerinde konumlanmış şehir hangisidir?


- - + +
-

That's right!

+

Doğru cevap!