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/flushSync.md
+29-27Lines changed: 29 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ title: flushSync
4
4
5
5
<Pitfall>
6
6
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.
8
8
9
9
</Pitfall>
10
10
11
11
<Intro>
12
12
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.
14
14
15
15
```js
16
16
flushSync(callback)
@@ -22,11 +22,12 @@ flushSync(callback)
22
22
23
23
---
24
24
25
-
## Reference {/*reference*/}
25
+
## Başvuru dokümanı {/*reference*/}
26
26
27
27
### `flushSync(callback)` {/*flushsync*/}
28
28
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
+
30
31
31
32
```js
32
33
import { flushSync } from'react-dom';
@@ -36,50 +37,51 @@ flushSync(() => {
36
37
});
37
38
```
38
39
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)
40
43
41
-
[See more examples below.](#usage)
44
+
#### Parametreler {/*parameters*/}
42
45
43
-
#### Parameters {/*parameters*/}
44
46
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.
45
48
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*/}
47
50
48
-
#### Returns {/*returns*/}
51
+
`flushSync``undefined` geri döndürür.
49
52
50
-
`flushSync` returns `undefined`.
53
+
#### Uyarılar {/*caveats*/}
51
54
52
-
#### Caveats {/*caveats*/}
55
+
*`flushSync` performansı önemli ölçüde düşürebilir. Sınırlı şekilde kullanın.
*`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.
53
59
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.
58
60
59
61
---
60
62
61
-
## Usage {/*usage*/}
63
+
## Kullanım {/*usage*/}
62
64
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*/}
64
66
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 <CodeStepstep={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 <CodeStepstep={1}>durum güncellemesi</CodeStep>'ni senkron bir şekilde işlemek için `flushSync` kullanın:
66
68
67
69
```js [[1, 2, "setSomething(123)"]]
68
70
flushSync(() => {
69
71
setSomething(123);
70
72
});
71
-
//By this line, the DOM is updated.
73
+
//Bu satıra gelindiğinde, DOM güncellenmiştir.
72
74
```
73
75
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.
75
77
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.
77
79
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.
79
81
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.
81
83
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:
83
85
84
86
<Sandpack>
85
87
@@ -122,12 +124,12 @@ export default function PrintApp() {
122
124
123
125
</Sandpack>
124
126
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.
126
128
127
129
<Pitfall>
128
130
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.
130
132
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.
0 commit comments