Skip to content

Commit c0a0f10

Browse files
Merge pull request #589 from bilalkarakollu/main
translate server components
2 parents ac68c18 + b6bc135 commit c0a0f10

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

src/content/reference/rsc/server-components.md

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ canary: true
55

66
<Intro>
77

8-
Server Components are a new type of Component that renders ahead of time, before bundling, in an environment separate from your client app or SSR server.
8+
Sunucu Bileşenleri, önceden, paketlemeden önce, istemci uygulamanızdan veya SSR sunucusundan ayrı bir ortamda render edilen yeni bir Bileşen türüdür.
99

1010
</Intro>
1111

12-
This separate environment is the "server" in React Server Components. Server Components can run once at build time on your CI server, or they can be run for each request using a web server.
12+
Bu ayrı ortam, React Sunucu Bileşenlerinde "sunucu" olarak adlandırılır. Sunucu Bileşenleri, CI sunucunuzda build zamanı sırasında bir kez çalışabilir veya her istekte bir web sunucusu kullanılarak çalıştırılabilir.
1313

1414
<InlineToc />
1515

1616
<Note>
1717

18-
#### How do I build support for Server Components? {/*how-do-i-build-support-for-server-components*/}
18+
#### Sunucu Bileşenleri için nasıl destek oluşturulur? {/*how-do-i-build-support-for-server-components*/}
1919

20-
While React Server Components in React 19 are stable and will not break between major versions, the underlying APIs used to implement a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x.
20+
React 19'daki React Sunucu Bileşenleri kararlıdır ve büyük sürümler arasında bozulmaz, ancak bir React Sunucu Bileşenleri paketleyicisi veya çatısı uygulamak için kullanılan temel API'ler semver'i takip etmez ve React 19.x sürümleri arasında minor sürümlerde bozulabilir.
2121

22-
To support React Server Components as a bundler or framework, we recommend pinning to a specific React version, or using the Canary release. We will continue working with bundlers and frameworks to stabilize the APIs used to implement React Server Components in the future.
22+
React Sunucu Bileşenleri'ni bir paketleyici veya çatı olarak desteklemek için, belirli bir React sürümüne sabitlemenizi veya Canary sürümünü kullanmanızı öneririz. Gelecekte, React Sunucu Bileşenleri'ni uygulamak için kullanılan API'leri stabilize etmek amacıyla paketleyiciler ve çatılarla çalışmaya devam edeceğiz.
2323

2424
</Note>
2525

26-
### Server Components without a Server {/*server-components-without-a-server*/}
27-
Server components can run at build time to read from the filesystem or fetch static content, so a web server is not required. For example, you may want to read static data from a content management system.
26+
### Sunucu Olmadan Sunucu Bileşenleri {/*server-components-without-a-server*/}
27+
Sunucu bileşenleri, dosya sisteminden okumak veya statik içerik almak için build zamanı sırasında çalışabilir, bu nedenle bir web sunucusu gerekmez. Örneğin, bir içerik yönetim sisteminden statik veriler okumak isteyebilirsiniz.
2828

29-
Without Server Components, it's common to fetch static data on the client with an Effect:
29+
Sunucu Bileşenleri olmadan, statik verileri istemcide bir Efekt ile almak yaygındır:
3030
```js
3131
// bundle.js
3232
import marked from 'marked'; // 35.9K (11.2K gzipped)
3333
import sanitizeHtml from 'sanitize-html'; // 206K (63.3K gzipped)
3434

3535
function Page({page}) {
3636
const [content, setContent] = useState('');
37-
// NOTE: loads *after* first page render.
37+
// NOT: İlk sayfa render'ından *sonra* yüklenir.
3838
useEffect(() => {
3939
fetch(`/api/content/${page}`).then((data) => {
4040
setContent(data.content);
@@ -53,56 +53,56 @@ app.get(`/api/content/:page`, async (req, res) => {
5353
});
5454
```
5555

56-
This pattern means users need to download and parse an additional 75K (gzipped) of libraries, and wait for a second request to fetch the data after the page loads, just to render static content that will not change for the lifetime of the page.
56+
Bu desen, kullanıcıların ek olarak 75K (gzipped) kütüphane indirip çözümlemeleri gerektiği ve sayfa yüklendikten sonra verileri almak için ikinci bir isteği beklemeleri gerektiği anlamına gelir; sadece sayfa ömrü boyunca değişmeyecek statik içeriği render etmek için.
5757

58-
With Server Components, you can render these components once at build time:
58+
Sunucu Bileşenleri ile, bu bileşenleri build zamanı sırasında bir kez render edebilirsiniz:
5959

6060
```js
61-
import marked from 'marked'; // Not included in bundle
62-
import sanitizeHtml from 'sanitize-html'; // Not included in bundle
61+
import marked from 'marked'; // Paket içinde dahil edilmemiş
62+
import sanitizeHtml from 'sanitize-html'; // Paket içinde dahil edilmemiş
6363

6464
async function Page({page}) {
65-
// NOTE: loads *during* render, when the app is built.
65+
// NOT: Render sırasında, uygulama build edilirken yüklenir.
6666
const content = await file.readFile(`${page}.md`);
6767

6868
return <div>{sanitizeHtml(marked(content))}</div>;
6969
}
7070
```
7171

72-
The rendered output can then be server-side rendered (SSR) to HTML and uploaded to a CDN. When the app loads, the client will not see the original `Page` component, or the expensive libraries for rendering the markdown. The client will only see the rendered output:
72+
Render edilen çıktı daha sonra sunucu tarafında render edilip (SSR) HTML olarak oluşturulabilir ve bir CDN'ye yüklenebilir. Uygulama yüklendiğinde, istemci orijinal `Page` bileşenini veya markdown render'lamak için kullanılan pahalı kütüphaneleri görmez. İstemci yalnızca render edilmiş çıktıyı görür:
7373

7474
```js
75-
<div><!-- html for markdown --></div>
75+
<div><!-- markdown için html --></div>
7676
```
7777

78-
This means the content is visible during first page load, and the bundle does not include the expensive libraries needed to render the static content.
78+
Bu, içeriğin ilk sayfa yüklemesi sırasında görünür olduğu ve paketlemenin statik içeriği render etmek için gereken pahalı kütüphaneleri içermediği anlamına gelir.
7979

8080
<Note>
8181

82-
You may notice that the Server Component above is an async function:
82+
Yukarıdaki Sunucu Bileşeni'nin bir async fonksiyon olduğunu fark etmiş olabilirsiniz:
8383

8484
```js
8585
async function Page({page}) {
8686
//...
8787
}
8888
```
8989

90-
Async Components are a new feature of Server Components that allow you to `await` in render.
90+
Async Bileşenleri, render sırasında `await` yapmanıza olanak tanıyan Sunucu Bileşenleri'nin yeni bir özelliğidir.
9191

92-
See [Async components with Server Components](#async-components-with-server-components) below.
92+
Aşağıda [Sunucu Bileşenleri ile Async Bileşenleri](#async-components-with-server-components) başlığına bakın.
9393

9494
</Note>
9595

96-
### Server Components with a Server {/*server-components-with-a-server*/}
97-
Server Components can also run on a web server during a request for a page, letting you access your data layer without having to build an API. They are rendered before your application is bundled, and can pass data and JSX as props to Client Components.
96+
### Sunucu ile Sunucu Bileşenleri {/*server-components-with-a-server*/}
97+
Sunucu Bileşenleri, bir sayfa isteği sırasında bir web sunucusunda da çalışabilir, böylece bir API oluşturmanıza gerek kalmadan veri katmanınıza erişmenizi sağlar. Uygulamanız paketlenmeden önce render edilirler ve veri ile JSX'i İstemci Bileşenlerine prop olarak geçirebilirler.
9898

99-
Without Server Components, it's common to fetch dynamic data on the client in an Effect:
99+
Sunucu Bileşenleri olmadan, dinamik verileri istemcide bir Efekt ile almak yaygındır:
100100

101101
```js
102102
// bundle.js
103103
function Note({id}) {
104104
const [note, setNote] = useState('');
105-
// NOTE: loads *after* first render.
105+
// NOT: İlk render'dan *sonra* yüklenir.
106106
useEffect(() => {
107107
fetch(`/api/notes/${id}`).then(data => {
108108
setNote(data.note);
@@ -119,8 +119,8 @@ function Note({id}) {
119119

120120
function Author({id}) {
121121
const [author, setAuthor] = useState('');
122-
// NOTE: loads *after* Note renders.
123-
// Causing an expensive client-server waterfall.
122+
// NOT: Note render'ı *sonra* yüklenir.
123+
// Pahalı bir istemci-sunucu şelalesine neden olur.
124124
useEffect(() => {
125125
fetch(`/api/authors/${id}`).then(data => {
126126
setAuthor(data.author);
@@ -145,13 +145,13 @@ app.get(`/api/authors/:id`, async (req, res) => {
145145
});
146146
```
147147

148-
With Server Components, you can read the data and render it in the component:
148+
Sunucu Bileşenleri ile veriyi okuyabilir ve bileşende render edebilirsiniz:
149149

150150
```js
151151
import db from './database';
152152

153153
async function Note({id}) {
154-
// NOTE: loads *during* render.
154+
// NOT: Render sırasında *yüklenir.
155155
const note = await db.notes.get(id);
156156
return (
157157
<div>
@@ -162,42 +162,42 @@ async function Note({id}) {
162162
}
163163

164164
async function Author({id}) {
165-
// NOTE: loads *after* Note,
166-
// but is fast if data is co-located.
165+
// NOT: Note'dan *sonra* yüklenir,
166+
// ancak veri aynı konumda ise hızlıdır.
167167
const author = await db.authors.get(id);
168168
return <span>By: {author.name}</span>;
169169
}
170170
```
171171

172-
The bundler then combines the data, rendered Server Components and dynamic Client Components into a bundle. Optionally, that bundle can then be server-side rendered (SSR) to create the initial HTML for the page. When the page loads, the browser does not see the original `Note` and `Author` components; only the rendered output is sent to the client:
172+
Paketleyici, ardından veriyi, render edilen Sunucu Bileşenlerini ve dinamik İstemci Bileşenlerini bir pakette birleştirir. İsteğe bağlı olarak, bu paket daha sonra sunucu tarafında render edilip (SSR) sayfanın ilk HTML'ini oluşturabilir. Sayfa yüklendiğinde, tarayıcı orijinal `Note` ve `Author` bileşenlerini görmez; yalnızca render edilmiş çıktı istemciye gönderilir:
173173

174174
```js
175175
<div>
176-
<span>By: The React Team</span>
177-
<p>React 19 is...</p>
176+
<span>Yazan: React Ekibi</span>
177+
<p>React 19...</p>
178178
</div>
179179
```
180180

181-
Server Components can be made dynamic by re-fetching them from a server, where they can access the data and render again. This new application architecture combines the simple “request/response” mental model of server-centric Multi-Page Apps with the seamless interactivity of client-centric Single-Page Apps, giving you the best of both worlds.
181+
Sunucu Bileşenleri, sunucudan tekrar alınıp veriye erişip yeniden render edilerek dinamik hale getirilebilir. Bu yeni uygulama mimarisi, sunucu odaklı Çok Sayfalı Uygulamalar'ın basit “istek/cevap” zihniyet modelini, istemci odaklı Tek Sayfa Uygulamalarının sorunsuz etkileşimiyle birleştirir ve size her iki dünyanın da en iyisini sunar.
182182

183-
### Adding interactivity to Server Components {/*adding-interactivity-to-server-components*/}
183+
### Sunucu Bileşenlerine Etkileşim Ekleme {/*adding-interactivity-to-server-components*/}
184184

185-
Server Components are not sent to the browser, so they cannot use interactive APIs like `useState`. To add interactivity to Server Components, you can compose them with Client Component using the `"use client"` directive.
185+
Sunucu Bileşenleri tarayıcıya gönderilmez, bu yüzden `useState` gibi etkileşimli API'leri kullanamazlar. Sunucu Bileşenlerine etkileşim eklemek için, bunları `"use client"` yönergesini kullanarak İstemci Bileşeni ile birleştirebilirsiniz.
186186

187187
<Note>
188188

189-
#### There is no directive for Server Components. {/*there-is-no-directive-for-server-components*/}
189+
#### Sunucu Bileşenleri için bir yönerge yoktur. {/*there-is-no-directive-for-server-components*/}
190190

191-
A common misunderstanding is that Server Components are denoted by `"use server"`, but there is no directive for Server Components. The `"use server"` directive is used for Server Actions.
191+
Yaygın bir yanlış anlama, Sunucu Bileşenlerinin `"use server"` ile belirtildiğidir, ancak Sunucu Bileşenleri için bir yönerge yoktur. `"use server"` yönergesi, Sunucu İşlemleri (Server Actions) için kullanılır.
192192

193-
For more info, see the docs for [Directives](/reference/rsc/directives).
193+
Daha fazla bilgi için, [Yönergeler](/reference/rsc/directives) dökümantasyonuna bakın.
194194

195195
</Note>
196196

197197

198-
In the following example, the `Notes` Server Component imports an `Expandable` Client Component that uses state to toggle its `expanded` state:
198+
Aşağıdaki örnekte, `Notes` Sunucu Bileşeni, `expanded` state'ini değiştirmek için state kullanan bir `Expandable` İstemci Bileşenini içe aktarır:
199199
```js
200-
// Server Component
200+
// Sunucu Bileşeni
201201
import Expandable from './Expandable';
202202

203203
async function Notes() {
@@ -214,7 +214,7 @@ async function Notes() {
214214
}
215215
```
216216
```js
217-
// Client Component
217+
// İstemci Bileşeni
218218
"use client"
219219

220220
export default function Expandable({children}) {
@@ -232,46 +232,46 @@ export default function Expandable({children}) {
232232
}
233233
```
234234

235-
This works by first rendering `Notes` as a Server Component, and then instructing the bundler to create a bundle for the Client Component `Expandable`. In the browser, the Client Components will see output of the Server Components passed as props:
235+
Bu, önce `Notes`'u bir Sunucu Bileşeni olarak render edip, ardından paketleyiciye `Expandable` İstemci Bileşeni için bir paket oluşturması talimatı vererek çalışır. Tarayıcıda, İstemci Bileşenleri, prop olarak geçirilen Sunucu Bileşenlerinin çıktısını görecektir:
236236

237237
```js
238238
<head>
239-
<!-- the bundle for Client Components -->
239+
<!-- İstemci Bileşenleri için paket -->
240240
<script src="bundle.js" />
241241
</head>
242242
<body>
243243
<div>
244244
<Expandable key={1}>
245-
<p>this is the first note</p>
245+
<p>bu ilk nottur</p>
246246
</Expandable>
247247
<Expandable key={2}>
248-
<p>this is the second note</p>
248+
<p>bu ikinci nottur</p>
249249
</Expandable>
250250
<!--...-->
251251
</div>
252252
</body>
253253
```
254254

255-
### Async components with Server Components {/*async-components-with-server-components*/}
255+
### Sunucu Bileşenleri ile Async Bileşenleri {/*async-components-with-server-components*/}
256256

257-
Server Components introduce a new way to write Components using async/await. When you `await` in an async component, React will suspend and wait for the promise to resolve before resuming rendering. This works across server/client boundaries with streaming support for Suspense.
257+
Sunucu Bileşenleri, async/await kullanarak Bileşen yazmanın yeni bir yolunu tanıtır. Bir async bileşen içinde `await` kullandığınızda, React render'lamaya devam etmeden önce promise'in çözülmesini bekler. Bu, sunucu/istemci sınırlarında, Suspense için stream desteğiyle çalışır.
258258

259-
You can even create a promise on the server, and await it on the client:
259+
Hatta sunucuda bir promise oluşturabilir ve bunu istemcide bekleyebilirsiniz:
260260

261261
```js
262-
// Server Component
262+
// Sunucu Bileşeni
263263
import db from './database';
264264

265265
async function Page({id}) {
266-
// Will suspend the Server Component.
266+
// Sunucu Bileşenini askıya alır.
267267
const note = await db.notes.get(id);
268268

269-
// NOTE: not awaited, will start here and await on the client.
269+
// NOT: beklenmemiş, burada başlayacak ve istemcide bekleyecek.
270270
const commentsPromise = db.comments.get(note.id);
271271
return (
272272
<div>
273273
{note}
274-
<Suspense fallback={<p>Loading Comments...</p>}>
274+
<Suspense fallback={<p>Yorumlar Yükleniyor...</p>}>
275275
<Comments commentsPromise={commentsPromise} />
276276
</Suspense>
277277
</div>
@@ -280,18 +280,18 @@ async function Page({id}) {
280280
```
281281

282282
```js
283-
// Client Component
283+
// İstemci Bileşeni
284284
"use client";
285285
import {use} from 'react';
286286

287287
function Comments({commentsPromise}) {
288-
// NOTE: this will resume the promise from the server.
289-
// It will suspend until the data is available.
288+
// NOT: Bu, sunucudan gelen promise'i yeniden başlatacak.
289+
// Veriler mevcut olana kadar askıya alınacak.
290290
const comments = use(commentsPromise);
291291
return comments.map(commment => <p>{comment}</p>);
292292
}
293293
```
294294

295-
The `note` content is important data for the page to render, so we `await` it on the server. The comments are below the fold and lower-priority, so we start the promise on the server, and wait for it on the client with the `use` API. This will Suspend on the client, without blocking the `note` content from rendering.
295+
`note` içeriği, sayfanın render edilmesi için önemli bir veri olduğu için, sunucuda `await` edilir. Yorumlar ise daha aşağıda ve önceliği düşük olduğundan, promise'i sunucuda başlatırız ve istemcide `use` API'si ile bekleriz. Bu, istemcide askıya alınacak, ancak `note` içeriğinin render edilmesini engellemeyecektir.
296296

297-
Since async components are [not supported on the client](#why-cant-i-use-async-components-on-the-client), we await the promise with `use`.
297+
Async bileşenler [istemcide desteklenmediği için](#why-cant-i-use-async-components-on-the-client), promise'i `use` ile bekleriz.

0 commit comments

Comments
 (0)