You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To create a portal, call `createPortal`, passing some JSX, and the DOM node where it should be rendered:
27
+
Bir portal oluşturmak için, biraz JSX ve render edilmesi gereken DOM düğümünü ileterek `createPortal`'ı çağırın:
28
28
29
29
```js
30
30
import { createPortal } from'react-dom';
@@ -40,35 +40,35 @@ import { createPortal } from 'react-dom';
40
40
</div>
41
41
```
42
42
43
-
[See more examples below.](#usage)
43
+
[Aşağıda daha fazla örnek görebilirsiniz.](#usage)
44
44
45
-
A portal only changes the physical placement of the DOM node. In every other way, the JSX you render into a portal acts as a child node of the React component that renders it. For example, the child can access the context provided by the parent tree, and events bubble up from children to parents according to the React tree.
45
+
Bir portal yalnızca DOM düğümünün fiziksel yerleşimini değiştirir. Diğer her şekilde, bir portala render ettiğiniz JSX, onu render eden React bileşeninin alt düğümü gibi davranır. Örneğin, alt eleman üst ağaç tarafından sağlanan context'e erişebilir ve olaylar React ağacına göre alt elemanlardan üst elemanlara doğru ilerler.
46
46
47
-
#### Parameters {/*parameters*/}
47
+
#### Parametreler {/*parameters*/}
48
48
49
-
* `children`: Anything that can be rendered with React, such as a piece of JSX (e.g.`<div />`or `<SomeComponent/>`), a [Fragment](/reference/react/Fragment) (`<>...</>`), a string or a number, or an array of these.
49
+
* `children`: Bir JSX parçası gibi React ile render edilebilen herhangi bir şey (örneğin`<div />`ya da `<HerhangiBileşen/>`), bir [Fragment](/reference/react/Fragment) (`<>...</>`), bir string ya da bir sayı, veya bunlardan oluşan bir dizi.
50
50
51
-
* `domNode`: Some DOM node, such as those returned by `document.getElementById()`. The node must already exist. Passing a different DOM node during an update will cause the portal content to be recreated.
51
+
* `domNode`: `document.getElementById()` tarafından döndürülen bir DOM düğümü. Düğüm halihazırda mevcut olmalıdır. Güncelleme sırasında farklı bir DOM düğümünün parametre olarak geçilmesi portal içeriğinin yeniden oluşturulmasına neden olacaktır.
52
52
53
-
* **optional** `key`: A unique string or number to be used as the portal's [key.](/learn/rendering-lists/#keeping-list-items-in-order-with-key)
53
+
* **opsiyonel** `key`: Portalın [anahtarı](/learn/rendering-lists/#keeping-list-items-in-order-with-key) olarak kullanılacak benzersiz bir string veya sayı.
54
54
55
-
#### Returns {/*returns*/}
55
+
#### Dönüş değeri {/*returns*/}
56
56
57
-
`createPortal`returns a React node that can be included into JSX or returned from a React component. If React encounters it in the render output, it will place the provided `children` inside the provided `domNode`.
57
+
`createPortal`JSX'e dahil edilebilen veya bir React bileşeninden döndürülebilen bir React düğümü döndürür. React render çıktısında bununla karşılaşırsa, sağlanan `children`'ı sağlanan `domNode`'un içine yerleştirecektir.
58
58
59
-
#### Caveats {/*caveats*/}
59
+
#### Uyarılar {/*caveats*/}
60
60
61
-
* Events from portals propagate according to the React tree rather than the DOM tree. For example, if you click inside a portal, and the portal is wrapped in `<div onClick>`, that`onClick`handler will fire. If this causes issues, either stop the event propagation from inside the portal, or move the portal itself up in the React tree.
61
+
* Portallardan gelen olaylar DOM ağacı yerine React ağacına göre yayılır. Örneğin, bir portalın içine tıklarsanız ve portal`<div onClick>` içine sarılırsa, bu`onClick`yöneticisi tetiklenecektir. Bu sorunlara neden oluyorsa, ya portalın içinden olay yayılımını durdurunuz ya da portalın kendisini React ağacında yukarı taşıyınız.
62
62
63
63
---
64
64
65
-
## Usage {/*usage*/}
65
+
## Kullanım {/*usage*/}
66
66
67
-
### Rendering to a different part of the DOM {/*rendering-to-a-different-part-of-the-dom*/}
67
+
### DOM'un farklı bir bölümüne render etme {/*rendering-to-a-different-part-of-the-dom*/}
68
68
69
-
*Portals* let your components render some of their children into a different place in the DOM. This lets a part of your component "escape" from whatever containers it may be in. For example, a component can display a modal dialog or a tooltip that appears above and outside of the rest of the page.
69
+
*Portallar* bileşenlerinizin bazı alt elemanlarını DOM'da farklı bir yerde render etmenize izin verir. Bu, bileşeninizin bir parçasının içinde bulunduğu konteynerlerden "kaçmasını" sağlar. Örneğin, bir bileşen, sayfanın geri kalanının üstünde ve dışında görünen bir modal iletişim kutusu veya bir araç ipucu görüntüleyebilir.
70
70
71
-
To create a portal, render the result of `createPortal`with <CodeStep step={1}>some JSX</CodeStep> and the <CodeStep step={2}>DOM node where it should go</CodeStep>:
71
+
Bir portal oluşturmak için, `createPortal`sonucunu <CodeStep step={1}>biraz JSX</CodeStep> ve <CodeStep step={2}>gitmesi gereken DOM düğümü</CodeStep> ile render ediniz:
72
72
73
73
```js [[1, 8, "<p>This child is placed in the document body.</p>"], [2, 9, "document.body"]]
74
74
import { createPortal } from'react-dom';
@@ -86,9 +86,9 @@ function MyComponent() {
86
86
}
87
87
```
88
88
89
-
React will put the DOM nodes for <CodeStep step={1}>the JSX you passed</CodeStep> inside of the <CodeStep step={2}>DOM node you provided</CodeStep>.
89
+
React, <CodeStep step={1}>sağladığınız JSX</CodeStep> için DOM düğümlerini <CodeStep step={2}>sağladığınız DOM düğümünün</CodeStep> içine yerleştirecektir.
90
90
91
-
Without a portal, the second `<p>`would be placed inside the parent `<div>`, but the portal "teleported" it into the [`document.body`:](https://developer.mozilla.org/en-US/docs/Web/API/Document/body)
91
+
Portal olmasaydı, ikinci `<p>`ana `<div>` içine yerleştirilirdi, ancak portal onu [`document.body`](https://developer.mozilla.org/en-US/docs/Web/API/Document/body) içine "ışınladı":
92
92
93
93
<Sandpack>
94
94
@@ -110,7 +110,7 @@ export default function MyComponent() {
110
110
111
111
</Sandpack>
112
112
113
-
Notice how the second paragraph visually appears outside the parent `<div>` with the border. If you inspect the DOM structure with developer tools, you'll see that the second `<p>` got placed directly into the `<body>`:
113
+
İkinci paragrafın kenarla birlikte görsel olarak ana `<div>`'in dışında nasıl göründüğüne dikkat edin. DOM yapısını geliştirici araçlarıyla incelerseniz, ikinci `<p>`'nin doğrudan `<body>` içine yerleştirildiğini görebilirsiniz:
114
114
115
115
```html {4-6,9}
116
116
<body>
@@ -125,15 +125,15 @@ Notice how the second paragraph visually appears outside the parent `<div>` with
125
125
</body>
126
126
```
127
127
128
-
A portal only changes the physical placement of the DOM node. In every other way, the JSX you render into a portal acts as a child node of the React component that renders it. For example, the child can access the context provided by the parent tree, and events still bubble up from children to parents according to the React tree.
128
+
Bir portal, DOM düğümünün yalnızca fiziksel yerleşimini değiştirir. Diğer her şekilde, bir portala render ettiğiniz JSX, onu render eden React bileşeninin alt düğümü gibi davranır. Örneğin, alt eleman ana ağaç tarafından sağlanan bağlama erişebilir ve olaylar React ağacına göre alt elemanlardan üst elemanlara doğru ilerlemeye devam eder.
129
129
130
130
---
131
131
132
-
### Rendering a modal dialog with a portal {/*rendering-a-modal-dialog-with-a-portal*/}
132
+
### Portal ile modal iletişim kutusu render etme {/*rendering-a-modal-dialog-with-a-portal*/}
133
133
134
-
You can use a portal to create a modal dialog that floats above the rest of the page, even if the component that summons the dialog is inside a container with `overflow: hidden` or other styles that interfere with the dialog.
134
+
Diyaloğu çağıran bileşen `overflow: hidden` veya diyaloğa müdahale eden diğer stillere sahip bir kapsayıcı içinde olsa bile, sayfanın geri kalanının üzerinde bulunan bir modal diyalog penceresi oluşturmak için bir portal kullanabilirsiniz.
135
135
136
-
In this example, the two containers have styles that disrupt the modal dialog, but the one rendered into a portal is unaffected because, in the DOM, the modal is not contained within the parent JSX elements.
136
+
Bu örnekte, iki kapsayıcı da modal iletişim kutusunu bozan stillere sahiptir, ancak DOM'da modal üst JSX öğeleri içinde yer almadığı için portalda render edilen stil etkilenmez.
It's important to make sure that your app is accessible when using portals. For instance, you may need to manage keyboard focus so that the user can move the focus in and out of the portal in a natural way.
241
+
Portalları kullanırken uygulamanızın erişilebilir olduğundan emin olmanız önemlidir. Örneğin, kullanıcının odağı doğal bir şekilde portalın içine ve dışına taşıyabilmesi için klavye odağını yönetmeniz gerekebilir.
242
242
243
-
Follow the [WAI-ARIA Modal Authoring Practices](https://www.w3.org/WAI/ARIA/apg/#dialog_modal) when creating modals. If you use a community package, ensure that it is accessible and follows these guidelines.
243
+
Modal'lar oluştururken [WAI-ARIA Modal Yazma Uygulamaları](https://www.w3.org/WAI/ARIA/apg/#dialog_modal) kılavuzunu izleyiniz. Bir topluluk paketi kullanıyorsanız, erişilebilir olduğundan ve bu yönergeleri izlediğinden emin olun.
244
244
245
245
</Pitfall>
246
246
247
247
---
248
248
249
-
### Rendering React components into non-React server markup {/*rendering-react-components-into-non-react-server-markup*/}
249
+
### React bileşenlerini React olmayan sunucu biçimlendirmesine render etme {/*rendering-react-components-into-non-react-server-markup*/}
250
250
251
-
Portals can be useful if your React root is only part of a static or server-rendered page that isn't built with React. For example, if your page is built with a server framework like Rails, you can create areas of interactivity within static areas such as sidebars. Compared with having [multiple separate React roots,](/reference/react-dom/client/createRoot#rendering-a-page-partially-built-with-react) portals let you treat the app as a single React tree with shared state even though its parts render to different parts of the DOM.
251
+
Portallar, React kökünüz React ile oluşturulmamış statik veya sunucu tarafından render edilen bir sayfanın parçasıysa yararlı olabilir. Örneğin, sayfanız Rails gibi bir sunucu çatısı ile oluşturulmuşsa, sidebar gibi statik alanlar içinde etkileşim alanları oluşturabilirsiniz. [Birden fazla ayrı React köküne](/reference/react-dom/client/createRoot#rendering-a-page-partially-built-with-react) sahip olmakla karşılaştırıldığında, portallar, parçaları DOM'un farklı bölümlerine render edilse bile uygulamayı paylaşılan state'e sahip tek bir React ağacı olarak ele almanızı sağlar.
252
252
253
253
<Sandpack>
254
254
@@ -342,15 +342,15 @@ p {
342
342
343
343
---
344
344
345
-
### Rendering React components into non-React DOM nodes {/*rendering-react-components-into-non-react-dom-nodes*/}
345
+
### React bileşenlerini React olmayan DOMdüğümlerine render etme {/*rendering-react-components-into-non-react-dom-nodes*/}
346
346
347
-
You can also use a portal to manage the content of a DOM node that's managed outside ofReact. For example, suppose you're integrating with a non-React map widget and you want to render React content inside a popup. To do this, declare a `popupContainer` state variable to store the DOM node you're going to render into:
347
+
React dışında yönetilen bir DOM düğümünün içeriğini yönetmek için de bir portal kullanabilirsiniz. Örneğin, React olmayan bir harita widget'ı ile entegre olduğunuzu ve React içeriğini bir açılır pencere içinde redner etmek istediğinizi varsayalım. Bunu yapmak için, içine render edeceğiniz DOM düğümünü saklamak üzere bir `popupContainer` state değişkeni tanımlayabilirsiniz:
0 commit comments