Skip to content

Translate Fragments Page #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions content/docs/fragments.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
id: fragments
title: Fragments
title: Fragment'ler
permalink: docs/fragments.html
---

A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding extra nodes to the DOM.
React'teki ortak model, bir bileşenin birden fazla öğe döndürmesidir. Fragmentler, Dom'a ekstra düğüm eklemeden bir alt elemanlar listesini gruplandırmanıza izin verir.

```js
render() {
Expand All @@ -18,11 +18,11 @@ render() {
}
```

There is also a new [short syntax](#short-syntax) for declaring them, but it isn't supported by all popular tools yet.
Onları tanımlamak için yeni bir [kısa sözdizimi](#short-syntax) de vardır, ancak henüz tüm popüler araçlar tarafından desteklenmemektedir.

## Motivation {#motivation}

A common pattern is for a component to return a list of children. Take this example React snippet:
Bir bileşenin alt eleman listesini döndürmesi için yaygın bir modeldir. Örnek için bu React kod parçasına bakın.

```jsx
class Table extends React.Component {
Expand All @@ -38,22 +38,22 @@ class Table extends React.Component {
}
```

`<Columns />` would need to return multiple `<td>` elements in order for the rendered HTML to be valid. If a parent div was used inside the `render()` of `<Columns />`, then the resulting HTML will be invalid.
Oluşturulan HTML'in geçerli olması için `<Columns />` birden fazla `<td>` öğesini döndürmesi gerekir. Bir üst div `<Columns />` bileşeninin `render()` metodu içinde kullanılmışsa, sonuçta ortaya çıkan HTML geçersiz olacaktır.

```jsx
class Columns extends React.Component {
render() {
return (
<div>
<td>Hello</td>
<td>World</td>
<td>Merhaba</td>
<td>Dünya</td>
</div>
);
}
}
```

results in a `<Table />` output of:
`<Table />` çıktısının sonucu:

```jsx
<table>
Expand All @@ -66,7 +66,7 @@ results in a `<Table />` output of:
</table>
```

Fragments solve this problem.
Fragmentler bu sorunu çözer.

## Usage {#usage}

Expand All @@ -75,56 +75,56 @@ class Columns extends React.Component {
render() {
return (
<React.Fragment>
<td>Hello</td>
<td>World</td>
<td>Merhaba</td>
<td>Dünya</td>
</React.Fragment>
);
}
}
```

which results in a correct `<Table />` output of:
`<Table />` çıktısının doğru sonucu:

```jsx
<table>
<tr>
<td>Hello</td>
<td>World</td>
<td>Merhaba</td>
<td>Dünya</td>
</tr>
</table>
```

### Short Syntax {#short-syntax}

There is a new, shorter syntax you can use for declaring fragments. It looks like empty tags:
Fragmentleri tanımlamak için kullanabileceğiniz yeni, daha kısa bir sözdizimi var. Boş etiketlere benziyor:

```jsx{4,7}
class Columns extends React.Component {
render() {
return (
<>
<td>Hello</td>
<td>World</td>
<td>Merhaba</td>
<td>Dünya</td>
</>
);
}
}
```

You can use `<></>` the same way you'd use any other element except that it doesn't support keys or attributes.
Anahtarları veya nitelikleri desteklememesi dışında, diğer elementleri kullandığınız gibi `<></>` kullanabilirsiniz.

Note that **[many tools don't support it yet](/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax)** so you might want to explicitly write `<React.Fragment>` until the tooling catches up.
Not, **[birçok araç henüz desteklemiyor](/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax)**. Bu nedenle, destekleninceye kadar `<React.Fragment>` yazmak isteyebilirsiniz.

### Keyed Fragments {#keyed-fragments}

Fragments declared with the explicit `<React.Fragment>` syntax may have keys. A use case for this is mapping a collection to an array of fragments -- for example, to create a description list:
Açıkça belirtilen `<React.Fragment>` sözdiziminin anahtarları olabilir. Bunun için bir kullanım durumu, bir koleksiyonun bir fragmentler dizisine eşlenmesidir. -- örneğin, bir açıklama listesi oluşturmak için:

```jsx
function Glossary(props) {
return (
<dl>
{props.items.map(item => (
// Without the `key`, React will fire a key warning
// `key` olmadan, React önemli bir uyarıyı tetikler
<React.Fragment key={item.id}>
<dt>{item.term}</dt>
<dd>{item.description}</dd>
Expand All @@ -135,8 +135,8 @@ function Glossary(props) {
}
```

`key` is the only attribute that can be passed to `Fragment`. In the future, we may add support for additional attributes, such as event handlers.
`key`, `Fragment`'e iletilebilecek tek özelliktir. Gelecekte, olay yöneticileri gibi ek özellikler için destek ekleyebiliriz.

### Live Demo {#live-demo}

You can try out the new JSX fragment syntax with this [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).
Bununla yeni JSX fragment sözdizimini deneyebilirsiniz [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).