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
Copy file name to clipboardExpand all lines: src/content/reference/react-dom/render.md
+42-33Lines changed: 42 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,15 @@ title: render
4
4
5
5
<Deprecated>
6
6
7
-
This API will be removed in a future major version of React.
7
+
Bu API, React'in gelecekteki bir ana sürümünde kaldırılacaktır.
8
8
9
-
In React 18,`render`was replaced by [`createRoot`.](/reference/react-dom/client/createRoot)Using `render` in React 18 will warn that your app will behave as if it’s running React 17. Learn more [here.](/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis)
9
+
React 18'de`render`[`createRoot`.](/reference/react-dom/client/createRoot)ile değiştirildi. React 18'de `render` kullanmak, uygulamanızın React 17 gibi davranacağı uyarısını verecektir. Daha fazla bilgi için [buraya](/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis) bakın.
10
10
11
11
</Deprecated>
12
12
13
13
<Intro>
14
14
15
-
`render`renders a piece of [JSX](/learn/writing-markup-with-jsx) ("React node") into a browser DOM node.
15
+
`render`bir [JSX](/learn/writing-markup-with-jsx) ("React düğümü") parçasını tarayıcı DOM düğümüne işler.
Call `render` to display a React component inside a browser DOM element.
31
+
Bir React bileşenini tarayıcı DOM düğümüne işlemek için `render`'ı çağırın.
32
32
33
33
```js
34
34
import { render } from'react-dom';
@@ -39,38 +39,43 @@ render(<App />, domNode);
39
39
40
40
React will display `<App />` in the `domNode`, and take over managing the DOM inside it.
41
41
42
-
An app fully built with React will usually only have one `render` call with its root component. A page that uses "sprinkles" of React for parts of the page may have as many `render` calls as needed.
42
+
React `<App />`'i `domNode` içinde görüntüleyecek ve içindeki DOM'u yönetmeye başlayacaktır.
43
43
44
-
[See more examples below.](#usage)
44
+
Tamamen React ile oluşturulmuş bir uygulama genellikle kök(root) bileşeni ile yalnızca bir `render` çağrısına sahip olacaktır. Sayfanın bazı bölümleri için React "sprinkles" kullanan bir sayfada, gerektiği kadar çok `render` çağrısına sahip olabilir.
45
45
46
-
#### Parameters {/*parameters*/}
46
+
[Daha fazla örnek için aşağıya bakın.](#usage)
47
+
48
+
#### Parametreler {/*parameters*/}
47
49
48
50
* `reactNode`: A *React node* that you want to display. This will usually be a piece of JSX like `<App />`, but you can also pass a React element constructed with [`createElement()`](/reference/react/createElement), a string, a number, `null`, or `undefined`.
49
51
50
-
* `domNode`: A [DOM element.](https://developer.mozilla.org/en-US/docs/Web/API/Element) React will display the `reactNode` you pass inside this DOM element. From this moment, React will manage the DOM inside the `domNode` and update it when your React tree changes.
52
+
* `reactNode`: Görüntülemek istediğiniz *React düğümü*. Bu genellikle `<App />` gibi bir JSX parçası olacaktır, ancak [`createElement()`](/reference/react/createElement) ile oluşturulmuş bir React elemanına, bir dize, bir sayı, `null` veya `undefined` da geçirebilirsiniz.
51
53
52
-
* **optional** `callback`: A function. If passed, React will call it after your component is placed into the DOM.
54
+
* `domNode`: [DOM elemanı.](https://developer.mozilla.org/en-US/docs/Web/API/Element) React, geçtiğiniz `reactNode`'u bu DOM elemanının içinde görüntüleyecektir. Bu andan itibaren, React `domNode` içindeki DOM'u yönetecek ve React ağacınız değiştiğinde güncelleyecektir.
53
55
56
+
* **optional** `callback`: Fonksiyon. Geçilirse, React bileşeniniz DOM'a yerleştirildikten sonra onu çağıracaktır.
54
57
55
-
#### Returns {/*returns*/}
58
+
#### Dönüş değerleri {/*returns*/}
56
59
57
60
`render` usually returns `null`. However, if the `reactNode` you pass is a *class component*, then it will return an instance of that component.
58
61
59
-
#### Caveats {/*caveats*/}
62
+
`render` genellikle `null` döndürür. Ancak, geçtiğiniz `reactNode` bir *sınıf bileşeni* ise, o zaman bileşenin bir örneğini döndürecektir.
63
+
64
+
#### Dikkat edilmesi gerekenler {/*caveats*/}
60
65
61
-
* In React 18,`render`was replaced by [`createRoot`.](/reference/react-dom/client/createRoot) Please use `createRoot` for React 18 and beyond.
66
+
* React 18'de`render` [`createRoot`.](/reference/react-dom/client/createRoot) ile değiştirildi. Lütfen React 18 ve sonrası için `createRoot` kullanın.
62
67
63
-
* The first time you call `render`, React will clear all the existing HTML content inside the `domNode`before rendering the React component into it. If your `domNode` contains HTML generated by React on the server or during the build, use [`hydrate()`](/reference/react-dom/hydrate) instead, which attaches the event handlers to the existing HTML.
68
+
* İlk `render` çağrısında, React, React bileşenini render etmek için `domNode`içindeki tüm mevcut HTML içeriğini temizleyecektir. `domNode`'unuz, sunucu veya derleme sırasında React tarafından oluşturulan HTML içeriyorsa, bunun yerine var olan HTML'e olay işleyicilerini ekleyen [`hydrate()`](/reference/react-dom/hydrate) kullanın.
64
69
65
-
* If you call `render` on the same `domNode` more than once, React will update the DOM as necessary to reflect the latest JSX you passed. React will decide which parts of the DOM can be reused and which need to be recreated by ["matching it up"](/learn/preserving-and-resetting-state) with the previously rendered tree. Calling `render` on the same `domNode` again is similar to calling the [`set`function](/reference/react/useState#setstate) on the root component: React avoids unnecessary DOM updates.
70
+
* Eğer aynı `domNode` üzerinde birden fazla `render` çağrısı yaparsanız, React, geçtiğiniz son JSX'i yansıtmak için gerektiğinde DOM'u güncelleyecektir. React, DOM'un hangi kısımlarının yeniden kullanılabileceğine ve hangilerinin önceki ağaçla(tree) ["eşleştirilerek"](/learn/preserving-and-resetting-state) yeniden oluşturulması gerektiğine karar verecektir. Aynı `domNode` üzerinde `render` çağrısı yapmak, kök bileşen (root component) üzerinde [`set`fonksiyonunu](/reference/react/useState#setstate) çağırmaya benzer: React gereksiz DOM güncellemelerinden kaçınır.
66
71
67
-
* If your app is fully built with React, you'll likely have only one `render`call in your app. (If you use a framework, it might do this call for you.) When you want to render a piece of JSXin a different part of the DOM tree that isn't a child of your component (for example, a modal or a tooltip), use [`createPortal`](/reference/react-dom/createPortal) instead of `render`.
72
+
* Eğer uygulamanız tamamen React ile oluşturulmuşsa, uygulamanızda muhtemelen yalnızca bir `render`çağrısı olacaktır. (Bir çatı(framework) kullanıyorsanız, bunu sizin için yapabilir.) JSX'in bir parçasını bileşeninizin bir alt öğesi olmayan DOM ağacının farklı bir yerinde görüntülemek istediğinizde (örneğin, bir modal veya bir tooltip), `render` yerine [`createPortal`](/reference/react-dom/createPortal) kullanın.
68
73
69
74
---
70
75
71
-
## Usage {/*usage*/}
76
+
## Kullanım {/*usage*/}
72
77
73
-
Call `render` to display a <CodeStep step={1}>React component</CodeStep> inside a <CodeStep step={2}>browser DOM node</CodeStep>.
78
+
Bir <CodeStep step={1}>React bileşenini</CodeStep> bir <CodeStep step={2}>tarayıcı DOM düğümünde</CodeStep> görüntülemek için `render`'ı çağırın.
Usually you shouldn't need to call `render` again or to call it in more places. From this point on, React will be managing the DOM of your application. To update the UI, your components will [use state.](/reference/react/useState)
111
+
Genellikle `render`'ı tekrar çağırmanıza veya daha fazla yere çağırmanıza gerek yoktur. Bu noktadan itibaren, React uygulamanızın DOM'unu yönetmeye başlayacaktır. Kullanıcı arayüzünü güncellemek için bileşenleriniz [state](/reference/react/useState) kullanacak.
### Birden çok kök oluşturma {/*rendering-multiple-roots*/}
109
116
110
-
If your page [isn't fully built with React](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page), call `render` for each top-level piece of UI managed by React.
117
+
Eğer sayfanız [tamamen React ile oluşturulmamışsa](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page), React tarafından yönetilen her bir üst düzey UI parçası için `render`'ı çağırın.
111
118
112
119
<Sandpack>
113
120
114
121
```html public/index.html
115
122
<nav id="navigation"></nav>
116
123
<main>
117
-
<p>This paragraph is not rendered by React (open index.html to verify).</p>
124
+
<p>Bu paragraf React tarafından render edilmiyor (doğrulamak içinindex.html'i açın).</p>
118
125
<section id="comments"></section>
119
126
</main>
120
127
```
@@ -139,8 +146,8 @@ render(
139
146
export function Navigation() {
140
147
return (
141
148
<ul>
142
-
<NavLink href="/">Home</NavLink>
143
-
<NavLink href="/about">About</NavLink>
149
+
<NavLink href="/">Anasayfa</NavLink>
150
+
<NavLink href="/about">Hakkında</NavLink>
144
151
</ul>
145
152
);
146
153
}
@@ -157,8 +164,8 @@ export function Comments() {
157
164
return (
158
165
<>
159
166
<h2>Comments</h2>
160
-
<Comment text="Hello!" author="Sophie"/>
161
-
<Comment text="How are you?" author="Sunil"/>
167
+
<Comment text="Merhaba!" author="Sophie" />
168
+
<Comment text="Nasılsın?" author="Sunil" />
162
169
</>
163
170
);
164
171
}
@@ -177,14 +184,16 @@ nav ul li { display: inline-block; margin-right: 20px; }
177
184
178
185
</Sandpack>
179
186
180
-
You can destroy the rendered trees with [`unmountComponentAtNode()`.](/reference/react-dom/unmountComponentAtNode)
187
+
[`unmountComponentAtNode()`](/reference/react-dom/unmountComponentAtNode) ile render edilmiş ağaçları(trees) yok edebilirsiniz.
181
188
182
189
---
183
190
184
-
### Updating the rendered tree {/*updating-the-rendered-tree*/}
191
+
### Render edilmiş ağaçları güncelleme {/*updating-the-rendered-tree*/}
185
192
186
193
You can call `render` more than once on the same DOM node. As long as the component tree structure matches up with what was previously rendered, React will [preserve the state.](/learn/preserving-and-resetting-state) Notice how you can type in the input, which means that the updates from repeated `render` calls every second are not destructive:
187
194
195
+
Aynı DOM düğümü üzerinde `render`'ı birden fazla kez çağırabilirsiniz. Bileşen ağacı yapısı önceki render edilmiş olanla eşleştiği sürece, React [durumu koruyacaktır.](/learn/preserving-and-resetting-state) Tekrarlanan `render` çağrılarından her saniye gelen güncellemelerin yıkıcı olmadığını gösteren girişe yazı yazabileceğinize dikkat edin:
196
+
188
197
<Sandpack>
189
198
190
199
```js index.js active
@@ -206,13 +215,13 @@ setInterval(() => {
206
215
export default function App({counter}) {
207
216
return (
208
217
<>
209
-
<h1>Hello, world! {counter}</h1>
210
-
<input placeholder="Type something here"/>
218
+
<h1>Merhaba Dünya! {counter}</h1>
219
+
<input placeholder="Buraya bir şey yazın" />
211
220
</>
212
221
);
213
222
}
214
223
```
215
224
216
225
</Sandpack>
217
226
218
-
It is uncommon to call`render`multiple times. Usually, you'll [update state](/reference/react/useState) inside your components instead.
227
+
Bu şekilde birden fazla kez`render`çağırmak nadirdir. Genellikle, bunun yerine bileşenlerinizin içinde [state'i güncellersiniz.](/reference/react/useState)
0 commit comments