Skip to content

Commit 9649b61

Browse files
authored
Merge pull request #483 from arif-ozberk/main
translate `createPortal`
2 parents 436b2cd + db753e2 commit 9649b61

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/content/reference/react-dom/createPortal.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: createPortal
44

55
<Intro>
66

7-
`createPortal` lets you render some children into a different part of the DOM.
7+
`createPortal` bazı alt elemanları DOM'un farklı bir bölümünde render etmenize olanak tanır.
88

99

1010
```js
@@ -20,11 +20,11 @@ title: createPortal
2020
2121
---
2222
23-
## Reference {/*reference*/}
23+
## Başvuru dokümanı {/*reference*/}
2424
2525
### `createPortal(children, domNode, key?)` {/*createportal*/}
2626
27-
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:
2828
2929
```js
3030
import { createPortal } from 'react-dom';
@@ -40,35 +40,35 @@ import { createPortal } from 'react-dom';
4040
</div>
4141
```
4242
43-
[See more examples below.](#usage)
43+
[Aşağıda daha fazla örnek görebilirsiniz.](#usage)
4444
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.
4646
47-
#### Parameters {/*parameters*/}
47+
#### Parametreler {/*parameters*/}
4848
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.
5050
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.
5252
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ı.
5454
55-
#### Returns {/*returns*/}
55+
#### Dönüş değeri {/*returns*/}
5656
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.
5858
59-
#### Caveats {/*caveats*/}
59+
#### Uyarılar {/*caveats*/}
6060
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.
6262
6363
---
6464
65-
## Usage {/*usage*/}
65+
## Kullanım {/*usage*/}
6666
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*/}
6868
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.
7070
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:
7272
7373
```js [[1, 8, "<p>This child is placed in the document body.</p>"], [2, 9, "document.body"]]
7474
import { createPortal } from 'react-dom';
@@ -86,9 +86,9 @@ function MyComponent() {
8686
}
8787
```
8888
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.
9090
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ı":
9292
9393
<Sandpack>
9494
@@ -110,7 +110,7 @@ export default function MyComponent() {
110110
111111
</Sandpack>
112112
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:
114114
115115
```html {4-6,9}
116116
<body>
@@ -125,15 +125,15 @@ Notice how the second paragraph visually appears outside the parent `<div>` with
125125
</body>
126126
```
127127
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.
129129
130130
---
131131
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*/}
133133
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.
135135
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.
137137
138138
<Sandpack>
139139
@@ -238,17 +238,17 @@ export default function ModalContent({ onClose }) {
238238
239239
<Pitfall>
240240
241-
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.
242242
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.
244244

245245
</Pitfall>
246246

247247
---
248248

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*/}
250250

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.
252252

253253
<Sandpack>
254254

@@ -342,15 +342,15 @@ p {
342342

343343
---
344344

345-
### Rendering React components into non-React DOM nodes {/*rendering-react-components-into-non-react-dom-nodes*/}
345+
### React bileşenlerini React olmayan DOM düğümlerine render etme {/*rendering-react-components-into-non-react-dom-nodes*/}
346346

347-
You can also use a portal to manage the content of a DOM node that's managed outside of React. 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:
348348
349349
```js
350350
const [popupContainer, setPopupContainer] = useState(null);
351351
```
352352
353-
When you create the third-party widget, store the DOM node returned by the widget so you can render into it:
353+
Üçüncü parti widget'ı oluşturduğunuzda, widget tarafından döndürülen DOM düğümünü depo edin, böylece içine render edebilirsiniz:
354354

355355
```js {5-6}
356356
useEffect(() => {
@@ -363,7 +363,7 @@ useEffect(() => {
363363
}, []);
364364
```
365365

366-
This lets you use `createPortal` to render React content into `popupContainer` once it becomes available:
366+
Bu, React içeriğini kullanılabilir hale geldiğinde `popupContainer` içine render etmek için `createPortal` kullanmanızı sağlar:
367367

368368
```js {3-6}
369369
return (
@@ -376,7 +376,7 @@ return (
376376
);
377377
```
378378

379-
Here is a complete example you can play with:
379+
İşte kurcalayabileceğiniz eksiksiz bir örnek:
380380

381381
<Sandpack>
382382

0 commit comments

Comments
 (0)