Skip to content
Open
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
42 changes: 21 additions & 21 deletions src/content/reference/react-dom/prefetchDNS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: prefetchDNS

<Intro>

`prefetchDNS` lets you eagerly look up the IP of a server that you expect to load resources from.
`prefetchDNS`, kaynak yüklemeyi beklediğiniz bir sunucunun IP adresini önceden sorgulamanızı sağlar.

```js
prefetchDNS("https://example.com");
Expand All @@ -16,11 +16,11 @@ prefetchDNS("https://example.com");

---

## Reference {/*reference*/}
## Başvuru dokümanı {/*reference*/}

### `prefetchDNS(href)` {/*prefetchdns*/}

To look up a host, call the `prefetchDNS` function from `react-dom`.
Bir sunucunun adresini sorgulamak için `react-dom` içindeki `prefetchDNS` fonksiyonunu çağırın.

```js
import { prefetchDNS } from 'react-dom';
Expand All @@ -32,34 +32,34 @@ function AppRoot() {

```

[See more examples below.](#usage)
[Daha fazla örnek için aşağıya bakınız.](#usage)

The prefetchDNS function provides the browser with a hint that it should look up the IP address of a given server. If the browser chooses to do so, this can speed up the loading of resources from that server.
`prefetchDNS` fonksiyonu, tarayıcıya verilen sunucunun IP adresini sorgulaması gerektiğine dair bir ipucu verir. Tarayıcı bunu yapmayı seçerse, o sunucudan yüklenecek kaynaklar daha hızlı yüklenebilir.

#### Parameters {/*parameters*/}
#### Parametreler {/*parameters*/}

* `href`: a string. The URL of the server you want to connect to.
* `href`: bir string. Bağlanmak istediğiniz sunucunun URL'si.

#### Returns {/*returns*/}
#### Dönüş değeri {/*returns*/}

`prefetchDNS` returns nothing.
`prefetchDNS` hiçbir şey döndürmez.

#### Caveats {/*caveats*/}
#### Uyarılar {/*caveats*/}

* Multiple calls to `prefetchDNS` with the same server have the same effect as a single call.
* In the browser, you can call `prefetchDNS` in any situation: while rendering a component, in an Effect, in an event handler, and so on.
* In server-side rendering or when rendering Server Components, `prefetchDNS` only has an effect if you call it while rendering a component or in an async context originating from rendering a component. Any other calls will be ignored.
* If you know the specific resources you'll need, you can call [other functions](/reference/react-dom/#resource-preloading-apis) instead that will start loading the resources right away.
* There is no benefit to prefetching the same server the webpage itself is hosted from because it's already been looked up by the time the hint would be given.
* Compared with [`preconnect`](/reference/react-dom/preconnect), `prefetchDNS` may be better if you are speculatively connecting to a large number of domains, in which case the overhead of preconnections might outweigh the benefit.
* Aynı sunucu için `prefetchDNS`'i birden çok kez çağırmak, tek bir çağrıyla aynı etkiye sahiptir.
* Tarayıcıda `prefetchDNS`'i her durumda çağırabilirsiniz: bir bileşeni render ederken, bir Effect içinde, bir olay yöneticisinde ve benzeri yerlerde.
* Sunucu taraflı render sırasında veya Sunucu Bileşenleri render edilirken `prefetchDNS` yalnızca bir bileşeni render ederken ya da bir bileşenin render edilmesinden kaynaklanan asenkron bir bağlamda çağırırsanız etki eder. Diğer tüm çağrılar yok sayılır.
* İhtiyaç duyacağınız kaynakları tam olarak biliyorsanız, bunun yerine kaynakları hemen yüklemeye başlayan [diğer fonksiyonları](/reference/react-dom/#resource-preloading-apis) çağırabilirsiniz.
* Web sayfasının barındırıldığı sunucunun kendisi için önceden DNS sorgusu yapmanın bir faydası yoktur, çünkü ipucu verildiği sırada bu sunucunun adresi zaten sorgulanmış olur.
* [`preconnect`](/reference/react-dom/preconnect) ile karşılaştırıldığında, çok sayıda alan adına tahmine dayalı olarak bağlanıyorsanız `prefetchDNS` daha iyi bir seçenek olabilir. Bu durumda önceden bağlantı kurmanın getirdiği ek yük, sağladığı faydadan daha ağır basabilir.

---

## Usage {/*usage*/}
## Kullanım {/*usage*/}

### Prefetching DNS when rendering {/*prefetching-dns-when-rendering*/}
### Render sırasında DNS'i önceden sorgulama {/*prefetching-dns-when-rendering*/}

Call `prefetchDNS` when rendering a component if you know that its children will load external resources from that host.
Bir bileşenin alt elemanlarının belirli bir sunucudan harici kaynaklar yükleyeceğini biliyorsanız, o bileşeni render ederken `prefetchDNS`'i çağırın.

```js
import { prefetchDNS } from 'react-dom';
Expand All @@ -70,9 +70,9 @@ function AppRoot() {
}
```

### Prefetching DNS in an event handler {/*prefetching-dns-in-an-event-handler*/}
### Bir olay yöneticisinde DNS'i önceden sorgulama {/*prefetching-dns-in-an-event-handler*/}

Call `prefetchDNS` in an event handler before transitioning to a page or state where external resources will be needed. This gets the process started earlier than if you call it during the rendering of the new page or state.
Harici kaynaklara ihtiyaç duyulacak bir sayfaya veya state'e geçmeden önce, bir olay yöneticisinde `prefetchDNS`'i çağırın. Böylece işlem, yeni sayfa veya state render edilirken çağırmanıza kıyasla daha erken başlar.

```js
import { prefetchDNS } from 'react-dom';
Expand Down
Loading