Skip to content

Commit 44a748d

Browse files
authored
Merge pull request #426 from mervekrblt/translate-writing-markup-with-jsx
Translate writing markup with JSX section
2 parents 8ae16bb + b1214f2 commit 44a748d

File tree

2 files changed

+77
-73
lines changed

2 files changed

+77
-73
lines changed

src/content/learn/writing-markup-with-jsx.md

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
---
2-
title: Writing Markup with JSX
2+
title: JSX ile İşaretleme (Markup) Yazma
33
---
44

55
<Intro>
66

7-
*JSX* is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file. Although there are other ways to write components, most React developers prefer the conciseness of JSX, and most codebases use it.
7+
*JSX*, bir JavaScript dosyası içinde HTML benzeri biçimlendirme (markup) yazmanıza olanak tanıyan bir JavaScript söz dizimi uzantısıdır. Bileşen yazmanın başka yolları olsa da çoğu React geliştiricisi, JSX'in sağladığı kolaylığı tercih eder ve çoğu kod tabanı (codebase) bunu kullanır.
88

99
</Intro>
1010

1111
<YouWillLearn>
1212

13-
* Why React mixes markup with rendering logic
14-
* How JSX is different from HTML
15-
* How to display information with JSX
13+
* React neden biçimlendirmeyi, render ile birleştirir?
14+
* JSX'in HTML'den farkı nedir?
15+
* JSX ile veri nasıl gösterilir?
1616

1717
</YouWillLearn>
1818

19-
## JSX: Putting markup into JavaScript {/*jsx-putting-markup-into-javascript*/}
19+
## JSX: Biçimlendirmeyi JavaScript'e dönüştürme {/*jsx-putting-markup-into-javascript*/}
2020

21-
The Web has been built on HTML, CSS, and JavaScript. For many years, web developers kept content in HTML, design in CSS, and logic in JavaScript—often in separate files! Content was marked up inside HTML while the page's logic lived separately in JavaScript:
21+
Web; HTML, CSS ve JavaScript üzerine inşa edilmiştir. Uzun yıllar boyunca web geliştiricileri, içeriği HTML'de, tasarımı CSS'te ve mantığı JavaScript'te -genellikle ayrı dosyalarda- tuttular! İçerik, HTML içinde tanımlanırken sayfanın mantığı, JavaScript'te ayrı olarak saklanıyordu:
2222

2323
<DiagramGroup>
2424

@@ -36,43 +36,43 @@ JavaScript
3636

3737
</DiagramGroup>
3838

39-
But as the Web became more interactive, logic increasingly determined content. JavaScript was in charge of the HTML! This is why **in React, rendering logic and markup live together in the same place—components.**
39+
Ancak Web daha etkileşimli hale geldikçe mantık, içeriğin önüne geçti. HTML'den JavaScript sorumluydu! İşte bu nedenle **React'te render mantığı ve biçimlendirme aynı yerde (bileşenlerde) birlikte bulunur.**
4040

4141
<DiagramGroup>
4242

43-
<Diagram name="writing_jsx_sidebar" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Sidebar which calls the function isLoggedIn, highlighted in yellow. Nested inside the function highlighted in purple is the p tag from before, and a Form tag referencing the component shown in the next diagram.">
43+
<Diagram name="writing_jsx_sidebar" height={330} width={325} alt="Önceki HTML ve JavaScript örneklerinin birlikte kullanıldığı React bileşeni. isLoggedIn fonksiyonunu çağıran sarı ile vurgulanan bölüm Sidebar fonksiyonudur. Mor renkle vurgulanan işlevin içinde, daha önceki p etiketi ve bir sonraki şemada gösterilen bileşene referans veren bir Form etiketi bulunur.">
4444

45-
`Sidebar.js` React component
45+
`Sidebar.js` React bileşeni
4646

4747
</Diagram>
4848

49-
<Diagram name="writing_jsx_form" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Form containing two handlers onClick and onSubmit highlighted in yellow. Following the handlers is HTML highlighted in purple. The HTML contains a form element with a nested input element, each with an onClick prop.">
49+
<Diagram name="writing_jsx_form" height={330} width={325} alt="Önceki HTML ve JavaScript örneklerinin birlikte kullanıldığı React bileşeni. Sarı renkle vurgulanmış onClick ve onSubmit yöneticilerini içeren bölüm, Form fonksiyonudur. Bu fonksiyondan sonra, mor renkle vurgulanmış HTML gelir. HTML, her biri onClick prop'una sahip girdilerden oluşan bir form öğesini içerir.">
5050

51-
`Form.js` React component
51+
`Form.js` React bileşeni
5252

5353
</Diagram>
5454

5555
</DiagramGroup>
5656

57-
Keeping a button's rendering logic and markup together ensures that they stay in sync with each other on every edit. Conversely, details that are unrelated, such as the button's markup and a sidebar's markup, are isolated from each other, making it safer to change either of them on their own.
57+
Bir butonun render mantığını ve biçimlendirmesini bir arada tutmak, her değişiklikte birbirleriyle senkronize kalmalarını sağlar. Aksine, butonun biçimlendirmesi ve kenar çubuğunun biçimlendirmesi gibi birbiriyle ilgisi olmayan ayrıntılar, birbirinden izole edilir. Böylece herhangi birinin tek başına değiştirilmesi daha güvenli hale gelir.
5858

59-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information. The best way to understand this is to convert some HTML markup to JSX markup.
59+
Her React bileşeni; React'ın, tarayıcıda render ettiği bazı işaretlemeler içerebilen bir JavaScript fonksiyonudur. React bileşenleri, bu işaretlemeyi temsil etmek için JSX adı verilen bir söz dizimi uzantısı kullanır. JSX, HTML'e çok benzer ancak biraz daha katı kurallara sahiptir ve dinamik verileri gösterebilir. Bu konuyu anlamanın en etkili yolu, birkaç HTML'i JSX'e dönüştürerek uygulamalı olarak pratik yapmaktır.
6060

6161
<Note>
6262

63-
JSX and React are two separate things. They're often used together, but you *can* [use them independently](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-a-jsx-transform) of each other. JSX is a syntax extension, while React is a JavaScript library.
63+
JSX ve React, iki ayrı kavramdır. Bunlar çoğunlukla birlikte kullanılır. Ancak, [bunları bağımsız olarak da](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-a-jsx-transform) *kullanabilirsiniz*. JSX bir söz dizimi uzantısıdır, React ise bir JavaScript kütüphanesidir.
6464

6565
</Note>
6666

67-
## Converting HTML to JSX {/*converting-html-to-jsx*/}
67+
## HTML'i JSX'e Dönüştürme {/*converting-html-to-jsx*/}
6868

69-
Suppose that you have some (perfectly valid) HTML:
69+
Elinizde (tamamen geçerli) bir HTML olduğunu varsayalım:
7070

7171
```html
7272
<h1>Hedy Lamarr's Todos</h1>
73-
<img
74-
src="https://i.imgur.com/yXOvdOSs.jpg"
75-
alt="Hedy Lamarr"
73+
<img
74+
src="https://i.imgur.com/yXOvdOSs.jpg"
75+
alt="Hedy Lamarr"
7676
class="photo"
7777
>
7878
<ul>
@@ -82,7 +82,7 @@ Suppose that you have some (perfectly valid) HTML:
8282
</ul>
8383
```
8484

85-
And you want to put it into your component:
85+
Ve bunu bileşeninize koymak istiyorsunuz:
8686

8787
```js
8888
export default function TodoList() {
@@ -92,7 +92,7 @@ export default function TodoList() {
9292
}
9393
```
9494

95-
If you copy and paste it as is, it will not work:
95+
Olduğu gibi kopyalayıp yapıştırırsanız çalışmayacaktır:
9696

9797

9898
<Sandpack>
@@ -102,9 +102,9 @@ export default function TodoList() {
102102
return (
103103
// This doesn't quite work!
104104
<h1>Hedy Lamarr's Todos</h1>
105-
<img
106-
src="https://i.imgur.com/yXOvdOSs.jpg"
107-
alt="Hedy Lamarr"
105+
<img
106+
src="https://i.imgur.com/yXOvdOSs.jpg"
107+
alt="Hedy Lamarr"
108108
class="photo"
109109
>
110110
<ul>
@@ -122,28 +122,28 @@ img { height: 90px }
122122
123123
</Sandpack>
124124
125-
This is because JSX is stricter and has a few more rules than HTML! If you read the error messages above, they'll guide you to fix the markup, or you can follow the guide below.
125+
Bunun nedeni JSX'in HTML'den daha katı ve fazla kurala sahip olmasıdır! Yukarıdaki hata mesajları, biçimlendirmeyi düzeltmeniz için size yol gösterecektir. Hatayı çözmek için aşağıdaki kılavuzu da takip edebilirsiniz.
126126
127127
<Note>
128128
129-
Most of the time, React's on-screen error messages will help you find where the problem is. Give them a read if you get stuck!
129+
Çoğu zaman, React'ın ekrandaki hata mesajları, sorunun nerede olduğunu bulmanıza yardımcı olacaktır. Takıldığınız yerde onları okuyun!
130130

131131
</Note>
132132

133-
## The Rules of JSX {/*the-rules-of-jsx*/}
133+
## JSX Kuralları {/*the-rules-of-jsx*/}
134134

135-
### 1. Return a single root element {/*1-return-a-single-root-element*/}
135+
### 1. Tek bir kök eleman döndürür {/*1-return-a-single-root-element*/}
136136

137-
To return multiple elements from a component, **wrap them with a single parent tag.**
137+
Bileşenden birden fazla öğe döndürmek için **bunları, tek bir ana etiketle sarın**
138138

139-
For example, you can use a `<div>`:
139+
Örneğin, `<div>` kullanabilirsiniz:
140140

141141
```js {1,11}
142142
<div>
143143
<h1>Hedy Lamarr's Todos</h1>
144-
<img
145-
src="https://i.imgur.com/yXOvdOSs.jpg"
146-
alt="Hedy Lamarr"
144+
<img
145+
src="https://i.imgur.com/yXOvdOSs.jpg"
146+
alt="Hedy Lamarr"
147147
class="photo"
148148
>
149149
<ul>
@@ -153,14 +153,14 @@ For example, you can use a `<div>`:
153153
```
154154

155155

156-
If you don't want to add an extra `<div>` to your markup, you can write `<>` and `</>` instead:
156+
Eğer fazladan bir `<div>` eklemek istemezseniz `<>` and `</>` kullanabilirsiniz:
157157

158158
```js {1,11}
159159
<>
160160
<h1>Hedy Lamarr's Todos</h1>
161-
<img
162-
src="https://i.imgur.com/yXOvdOSs.jpg"
163-
alt="Hedy Lamarr"
161+
<img
162+
src="https://i.imgur.com/yXOvdOSs.jpg"
163+
alt="Hedy Lamarr"
164164
class="photo"
165165
>
166166
<ul>
@@ -169,27 +169,27 @@ If you don't want to add an extra `<div>` to your markup, you can write `<>` and
169169
</>
170170
```
171171

172-
This empty tag is called a *[Fragment.](/reference/react/Fragment)* Fragments let you group things without leaving any trace in the browser HTML tree.
172+
Bu boş etiket, *[Fragment](/reference/react/Fragment)* olarak adlandırılır. Fragment'lar, tarayıcı HTML ağacında, herhangi bir iz bırakmadan, öğeleri gruplandırmanıza olanak tanır.
173173
174174
<DeepDive>
175175
176-
#### Why do multiple JSX tags need to be wrapped? {/*why-do-multiple-jsx-tags-need-to-be-wrapped*/}
176+
#### Neden birden fazla JSX etiketinin sarılması gerekiyor? {/*why-do-multiple-jsx-tags-need-to-be-wrapped*/}
177177
178-
JSX looks like HTML, but under the hood it is transformed into plain JavaScript objects. You can't return two objects from a function without wrapping them into an array. This explains why you also can't return two JSX tags without wrapping them into another tag or a Fragment.
178+
JSX, HTML gibi görünür ancak arka planda JavaScript nesnelerine dönüştürülür. Bir fonksiyondan iki nesneyi, bir diziye sarmadan döndüremezsiniz. Bu, iki JSX etiketini başka bir etikete veya bir Fragment'e sarmadan neden döndüremediğinizi de açıklar.
179179

180180
</DeepDive>
181181

182-
### 2. Close all the tags {/*2-close-all-the-tags*/}
182+
### 2. Tüm etiketleri kapatın {/*2-close-all-the-tags*/}
183183

184-
JSX requires tags to be explicitly closed: self-closing tags like `<img>` must become `<img />`, and wrapping tags like `<li>oranges` must be written as `<li>oranges</li>`.
184+
JSX, etiketlerin bariz bir şekilde kapatılmasını gerektirir: `<img>` gibi kendiliğinden kapanan etiketler, `<img />` bu şekilde kapatılmalıdır.`<li>oranges` gibi etiketler`<li>oranges</li>` şeklinde sarmalanmalıdır.
185185

186-
This is how Hedy Lamarr's image and list items look closed:
186+
Hedy Lamarr'ın fotoğraf ve liste öğeleri bu şekilde kapatılmıştır:
187187
188188
```js {2-6,8-10}
189189
<>
190-
<img
191-
src="https://i.imgur.com/yXOvdOSs.jpg"
192-
alt="Hedy Lamarr"
190+
<img
191+
src="https://i.imgur.com/yXOvdOSs.jpg"
192+
alt="Hedy Lamarr"
193193
class="photo"
194194
/>
195195
<ul>
@@ -200,33 +200,33 @@ This is how Hedy Lamarr's image and list items look closed:
200200
</>
201201
```
202202
203-
### 3. camelCase <s>all</s> most of the things! {/*3-camelcase-salls-most-of-the-things*/}
203+
### 3. camelCase <s>her şey</s> çoğu şey! {/*3-camelcase-salls-most-of-the-things*/}
204204
205-
JSX turns into JavaScript and attributes written in JSX become keys of JavaScript objects. In your own components, you will often want to read those attributes into variables. But JavaScript has limitations on variable names. For example, their names can't contain dashes or be reserved words like `class`.
205+
JSX, JavaScript'e dönüşür ve JSX'te yazılan özellikler JavaScript nesnelerinin anahtarları haline gelir. Kendi bileşenlerinizde, genellikle bu özellikleri, değişken olarak okumak isteyeceksiniz. Ancak JavaScript'in değişken adları konusunda sınırlamaları vardır. Örneğin, adları tire içeremez veya `class` gibi rezerve edilmiş sözcükler olamaz.
206206

207-
This is why, in React, many HTML and SVG attributes are written in camelCase. For example, instead of `stroke-width` you use `strokeWidth`. Since `class` is a reserved word, in React you write `className` instead, named after the [corresponding DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Element/className):
207+
Bu nedenle, React'te, birçok HTML ve SVG özellikleri camelCase ile yazılır. Örneğin, `stroke-width` yerine `strokeWidth`. `class` rezerve edilmiş sözcük olduğu için React'te, bunun yerine [ilgili DOM özelliğinden](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) sonra `className` yazarsınız:
208208

209209
```js {4}
210-
<img
211-
src="https://i.imgur.com/yXOvdOSs.jpg"
212-
alt="Hedy Lamarr"
210+
<img
211+
src="https://i.imgur.com/yXOvdOSs.jpg"
212+
alt="Hedy Lamarr"
213213
className="photo"
214214
/>
215215
```
216216

217-
You can [find all these attributes in the list of DOM component props.](/reference/react-dom/components/common) If you get one wrong, don't worry—React will print a message with a possible correction to the [browser console.](https://developer.mozilla.org/docs/Tools/Browser_Console)
217+
[Tüm bu nitelikleri DOM bileşeni prop'ları listesinde](/reference/react-dom/components/common) bulabilirsiniz. Eğer yanlış yaparsanız endişelenmeyin-React [tarayıcı konsoluna](https://developer.mozilla.org/docs/Tools/Browser_Console), yanlışınızı düzeltmeniz için bir mesaj yazdıracaktır.
218218
219219
<Pitfall>
220220
221-
For historical reasons, [`aria-*`](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) and [`data-*`](https://developer.mozilla.org/docs/Learn/HTML/Howto/Use_data_attributes) attributes are written as in HTML with dashes.
221+
Tarihi nedenlerden dolayı, [`aria-*`](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) ve [`data-*`](https://developer.mozilla.org/docs/Learn/HTML/Howto/Use_data_attributes) özellikleri HTML'de olduğu gibi tire ile yazılır.
222222

223223
</Pitfall>
224224

225-
### Pro-tip: Use a JSX Converter {/*pro-tip-use-a-jsx-converter*/}
225+
### Uzman Tavsiyesi: JSX Dönüştürücü Kullanın {/*pro-tip-use-a-jsx-converter*/}
226226

227-
Converting all these attributes in existing markup can be tedious! We recommend using a [converter](https://transform.tools/html-to-jsx) to translate your existing HTML and SVG to JSX. Converters are very useful in practice, but it's still worth understanding what is going on so that you can comfortably write JSX on your own.
227+
Mevcut biçimlendirmede, tüm bu özellikleri dönüştürmek can sıkıcı olabilir! Mevcut HTML ve SVG'nizi JSX'e çevirmek için bir [dönüştürücü](https://transform.tools/html-to-jsx) kullanmanızı öneririz. Dönüştürücüler pratikte çok kullanışlıdır. Yine de kendi başınıza rahatça JSX yazabilmeniz için neler olup bittiğini anlamakta fayda vardır.
228228

229-
Here is your final result:
229+
İşte final sonucunuz:
230230

231231
<Sandpack>
232232

@@ -235,10 +235,10 @@ export default function TodoList() {
235235
return (
236236
<>
237237
<h1>Hedy Lamarr's Todos</h1>
238-
<img
239-
src="https://i.imgur.com/yXOvdOSs.jpg"
240-
alt="Hedy Lamarr"
241-
className="photo"
238+
<img
239+
src="https://i.imgur.com/yXOvdOSs.jpg"
240+
alt="Hedy Lamarr"
241+
className="photo"
242242
/>
243243
<ul>
244244
<li>Invent new traffic lights</li>
@@ -258,21 +258,21 @@ img { height: 90px }
258258

259259
<Recap>
260260

261-
Now you know why JSX exists and how to use it in components:
261+
Artık JSX'in neden var olduğunu ve bileşenlerde nasıl kullanılacağını biliyorsunuz:
262262
263-
* React components group rendering logic together with markup because they are related.
264-
* JSX is similar to HTML, with a few differences. You can use a [converter](https://transform.tools/html-to-jsx) if you need to.
265-
* Error messages will often point you in the right direction to fixing your markup.
263+
* React bileşenleri, birbirleriyle ilişkili oldukları için render mantığını biçimlendirme ile birlikte gruplandırır.
264+
* JSX, birkaç farkla HTML'e benzer. Eğer ihtiyacınız olursa [dönüştürücü](https://transform.tools/html-to-jsx) kullanabilirsiniz.
265+
* Hata mesajları, genellikle biçimlendirmenizi düzeltmeniz için size doğru yolu gösterecektir.
266266

267267
</Recap>
268268

269269

270270

271271
<Challenges>
272272

273-
#### Convert some HTML to JSX {/*convert-some-html-to-jsx*/}
273+
#### Aşağıdaki HTML'i JSX'e dönüştürün {/*convert-some-html-to-jsx*/}
274274

275-
This HTML was pasted into a component, but it's not valid JSX. Fix it:
275+
Bu HTML bir bileşene eklenmiş ancak geçerli bir JSX değildir. Bunu düzeltiniz:
276276

277277
<Sandpack>
278278

@@ -308,7 +308,7 @@ export default function Bio() {
308308

309309
</Sandpack>
310310

311-
Whether to do it by hand or using the converter is up to you!
311+
Elle mi yoksa dönüştürücü kullanarak mı yapacağınız size kalmış!
312312

313313
<Solution>
314314

src/sidebarLearn.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"path": "/learn/importing-and-exporting-components"
6161
},
6262
{
63-
"title": "Writing Markup with JSX",
63+
"title": "JSX ile İşaretleme (Markup) Yazma",
6464
"path": "/learn/writing-markup-with-jsx"
6565
},
6666
{
@@ -123,7 +123,9 @@
123123
{
124124
"title": "Managing State",
125125
"path": "/learn/managing-state",
126-
"tags": ["intermediate"],
126+
"tags": [
127+
"intermediate"
128+
],
127129
"routes": [
128130
{
129131
"title": "Girdiye State ile Reaksiyon Verme",
@@ -158,7 +160,9 @@
158160
{
159161
"title": "Escape Hatches",
160162
"path": "/learn/escape-hatches",
161-
"tags": ["advanced"],
163+
"tags": [
164+
"advanced"
165+
],
162166
"routes": [
163167
{
164168
"title": "Referencing Values with Refs",
@@ -195,4 +199,4 @@
195199
]
196200
}
197201
]
198-
}
202+
}

0 commit comments

Comments
 (0)