Skip to content

Commit 31aec51

Browse files
authored
Merge pull request #448 from K2adir/main
translate `flushSync`
2 parents fc96e93 + a69c07c commit 31aec51

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

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

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ title: flushSync
44

55
<Pitfall>
66

7-
Using `flushSync` is uncommon and can hurt the performance of your app.
7+
`flushSync` kullanımı yaygın değildir ve uygulamanızın performansına zarar verebilir.
88

99
</Pitfall>
1010

1111
<Intro>
1212

13-
`flushSync` lets you force React to flush any updates inside the provided callback synchronously. This ensures that the DOM is updated immediately.
13+
`flushSync`, sağlanan callback içindeki herhangi bir güncellemeyi zorla ve senkronize bir şekilde işlemeye olanak sağlar. Bu, DOM'u anında güncelleyecektir.
1414

1515
```js
1616
flushSync(callback)
@@ -22,11 +22,12 @@ flushSync(callback)
2222

2323
---
2424

25-
## Reference {/*reference*/}
25+
## Başvuru dokümanı {/*reference*/}
2626

2727
### `flushSync(callback)` {/*flushsync*/}
2828

29-
Call `flushSync` to force React to flush any pending work and update the DOM synchronously.
29+
Bekleyen tüm islemleri aninda calistirmak ve DOM'u hemen güncellemek için `flushSync` fonksiyonunu kullanın.
30+
3031

3132
```js
3233
import { flushSync } from 'react-dom';
@@ -36,50 +37,51 @@ flushSync(() => {
3637
});
3738
```
3839

39-
Most of the time, `flushSync` can be avoided. Use `flushSync` as last resort.
40+
Çoğunlukla, `flushSync` kullanmanıza gerek yoktur. `flushSync`'i sadece son çareniz olduğunda kullanın.
41+
42+
[Daha fazla örnek için aşağıdaki linki tıklayın.](#usage)
4043

41-
[See more examples below.](#usage)
44+
#### Parametreler {/*parameters*/}
4245

43-
#### Parameters {/*parameters*/}
4446

47+
* `callback`: Bir fonksiyon. React, bu callback'i hemen çağırır ve içerdiği tüm güncellemeleri senkronize bir şekilde gerçekleştirir. Aynı zamanda bekleyen güncellemeleri, Effect'leri veya Effect'ler içindeki güncellemeleri de gerçekleştirebilir. Eğer `flushSync` çağrısı sonucunda bir güncelleme duraklatılırsa, fallback'ler tekrar görünebilir.
4548

46-
* `callback`: A function. React will immediately call this callback and flush any updates it contains synchronously. It may also flush any pending updates, or Effects, or updates inside of Effects. If an update suspends as a result of this `flushSync` call, the fallbacks may be re-shown.
49+
#### Geri Döndürür {/*returns*/}
4750

48-
#### Returns {/*returns*/}
51+
`flushSync` `undefined` geri döndürür.
4952

50-
`flushSync` returns `undefined`.
53+
#### Uyarılar {/*caveats*/}
5154

52-
#### Caveats {/*caveats*/}
55+
* `flushSync` performansı önemli ölçüde düşürebilir. Sınırlı şekilde kullanın.
56+
* `flushSync` bekleyen Suspense sınırlarını `fallback` durumunu göstermeye mecbur bırakabilir.
57+
* `flushSync` bekleyen effect'leri tetikleyebilir ve içerdikleri güncellemeleri döndürmeden önce senkron bir şekilde uygulayabilir.
58+
* `flushSync` callback içindeki güncellemeleri işlemek gerektiğinde, callback dışındaki güncellemeleri işleyebilir. Örneğin, bir tıklama sonucu bekleyen güncellemeler varsa, React bu güncellemeleri callback içindeki güncellemeleri işlemeden önce işleyebilir.
5359

54-
* `flushSync` can significantly hurt performance. Use sparingly.
55-
* `flushSync` may force pending Suspense boundaries to show their `fallback` state.
56-
* `flushSync` may run pending effects and synchronously apply any updates they contain before returning.
57-
* `flushSync` may flush updates outside the callback when necessary to flush the updates inside the callback. For example, if there are pending updates from a click, React may flush those before flushing the updates inside the callback.
5860

5961
---
6062

61-
## Usage {/*usage*/}
63+
## Kullanım {/*usage*/}
6264

63-
### Flushing updates for third-party integrations {/*flushing-updates-for-third-party-integrations*/}
65+
### Üçüncü Parti Entegrasyonlar için Güncellemeleri İşleme {/*flushing-updates-for-third-party-integrations*/}
6466

65-
When integrating with third-party code such as browser APIs or UI libraries, it may be necessary to force React to flush updates. Use `flushSync` to force React to flush any <CodeStep step={1}>state updates</CodeStep> inside the callback synchronously:
67+
Tarayıcı API'leri veya UI kütüphaneleri gibi üçüncü parti kodlarıyla entegrasyon sağlarken, React'in güncellemeleri zorla işlemesi gerekebilir. Callback içerisindeki herhangi bir <CodeStep step={1}>durum güncellemesi</CodeStep>'ni senkron bir şekilde işlemek için `flushSync` kullanın:
6668

6769
```js [[1, 2, "setSomething(123)"]]
6870
flushSync(() => {
6971
setSomething(123);
7072
});
71-
// By this line, the DOM is updated.
73+
// Bu satıra gelindiğinde, DOM güncellenmiştir.
7274
```
7375

74-
This ensures that, by the time the next line of code runs, React has already updated the DOM.
76+
Bir sonraki kod satırı çalıştığında, React'in zaten DOM'u güncellediğini garanti eder.
7577

76-
**Using `flushSync` is uncommon, and using it often can significantly hurt the performance of your app.** If your app only uses React APIs, and does not integrate with third-party libraries, `flushSync` should be unnecessary.
78+
**`flushSync` kullanımı yaygın değildir ve sık kullanımı uygulamanızın performansını büyük ölçüde düşürebilir.** Eğer uygulamanız sadece React API'lerini kullanıyorsa ve üçüncü parti kütüphanelerle entegre değilse, `flushSync`'e ihtiyaç duyumamalıdır.
7779

78-
However, it can be helpful for integrating with third-party code like browser APIs.
80+
Ancak, tarayıcı API'leri gibi üçüncü parti kodlarla entegrasyon yapmak için kullanışlı olabilir.
7981

80-
Some browser APIs expect results inside of callbacks to be written to the DOM synchronously, by the end of the callback, so the browser can do something with the rendered DOM. In most cases, React handles this for you automatically. But in some cases it may be necessary to force a synchronous update.
82+
Bazı tarayıcı API'leri, callback içindeki sonuçların callback'in sonuna kadar DOM'a senkron bir şekilde yazılmasını bekler, böylece tarayıcı, oluşturulan DOM ile bir şeyler yapabilir. Çoğu durumda, React bunu sizin için otomatik olarak halleder. Ancak bazı durumlarda senkron bir güncellemeyi zorlamak gerekebilir.
8183

82-
For example, the browser `onbeforeprint` API allows you to change the page immediately before the print dialog opens. This is useful for applying custom print styles that allow the document to display better for printing. In the example below, you use `flushSync` inside of the `onbeforeprint` callback to immediately "flush" the React state to the DOM. Then, by the time the print dialog opens, `isPrinting` displays "yes":
84+
Örneğin, tarayıcının `onbeforeprint` API'si, yazdırma iletişim kutusu açılmadan hemen önce sayfayı değiştirmenize olanak sağlar. Bu, belgenin yazdırma için daha iyi bir şekilde görüntülenmesine olanak sağlayan özel yazdırma stillerinin uygulanması için yararlıdır. Aşağıdaki örnekte, `onbeforeprint` callback'inde `flushSync`'i hemen React durumunu DOM'a "güncellemek" için kullanıyorsunuz. Böylece, yazdırma penceresi açıldığında, `isPrinting` "yes" olarak görünür:
8385

8486
<Sandpack>
8587

@@ -122,12 +124,12 @@ export default function PrintApp() {
122124

123125
</Sandpack>
124126

125-
Without `flushSync`, when the print dialog will display `isPrinting` as "no". This is because React batches the updates asynchronously and the print dialog is displayed before the state is updated.
127+
`flushSync` olmadığında, yazdırma diyalogu `isPrinting`'i "hayır" olarak gösterir. Bunun sebebi, React'in güncellemeleri asenkron bir şekilde biriktirmesi ve yazdırma diyalogunun durum güncellenmeden önce görüntülenmesidir.
126128

127129
<Pitfall>
128130

129-
`flushSync` can significantly hurt performance, and may unexpectedly force pending Suspense boundaries to show their fallback state.
131+
`flushSync`, performansı önemli ölçüde etkileyebilir ve bekleyen Suspense sınırlarını beklenmedik şekilde fallback durumlarını göstermeye zorlayabilir.
130132

131-
Most of the time, `flushSync` can be avoided, so use `flushSync` as a last resort.
133+
Çoğu zaman, `flushSync`'in kullanılımına gerek yoktur, dolayısıyla `flushSync`'i son çare olarak kullanın.
132134

133135
</Pitfall>

0 commit comments

Comments
 (0)