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
+26-26Lines changed: 26 additions & 26 deletions
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`এর ব্যবহার খুব একটা হয় না এবং এটা আপনার অ্যাপের পারফরম্যান্সে বিরূপ প্রভাব ফেলতে পারে।
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`আপনাকে সাহায্য করবে যদি আপনি কোন একটি কলব্যাকের মধ্যকার যেকোন আপডেট সিঙ্ক্রোনাসভাবে flush করার জন্য React কে বাধ্য করতে চান। এটা নিশ্চিত করে যে DOM সাথে সাথে আপডেট হয়ে যাচ্ছে।
14
14
15
15
```js
16
16
flushSync(callback)
@@ -22,11 +22,11 @@ flushSync(callback)
22
22
23
23
---
24
24
25
-
## Reference {/*reference*/}
25
+
## রেফারেন্স {/*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
+
কোন একটি pending কাজ ফ্লাশ করার জন্য এবং একই সাথে DOM আপডেট করার জন্য React কে বাধ্য করতে এবং `flushSync` কল করুন।
30
30
31
31
```js
32
32
import { flushSync } from'react-dom';
@@ -36,33 +36,33 @@ flushSync(() => {
36
36
});
37
37
```
38
38
39
-
Most of the time, `flushSync`can be avoided. Use `flushSync`as last resort.
39
+
বেশির ভাগ সময়, `flushSync`এর ব্যবহার এড়িয়ে চলা যায়। `flushSync`কে ব্যবহার করুন last resort হিসেবে।
40
40
41
-
[See more examples below.](#usage)
41
+
[নিচে আরো উদাহরণ দেখুন।](#usage)
42
42
43
-
#### Parameters {/*parameters*/}
43
+
#### প্যারামিটার {/*parameters*/}
44
44
45
45
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.
46
+
*`callback`: একটি ফাংশন। React সাথে সাথে এই কলব্যাক কল দিবে এবং এর মধ্যে থাকা যেকোন আপডেট সিঙ্ক্রোনাসভাবে ফ্লাশ করে দিবে। এটা একই সাথে যেকোন পেন্ডীং আপডেট, Effect অথবা Effect এর মধ্যকার আপডেট ফ্লাশ করে দিতে পারে। যদি এই `flushSync`কলের জন্য একটি আপডেট সাসপেন্ড হয়ে যায়, ফলব্যাক আবার দেখা যেতে পারে।
47
47
48
-
#### Returns {/*returns*/}
48
+
#### রিটার্ন {/*returns*/}
49
49
50
-
`flushSync`returns `undefined`.
50
+
`flushSync`রিটার্ন করে `undefined`।
51
51
52
-
#### Caveats {/*caveats*/}
52
+
#### সতর্কতা {/*caveats*/}
53
53
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.
54
+
*`flushSync`বেশ উল্লেখজনকভাবে পারফরম্যান্স কমিয়ে দিতে পারে, কম ব্যবহারের চেষ্টা করুন।
55
+
*`flushSync`পেন্ডিং সাসপেন্স বাউন্ডারিগুলোকে তাদের `fallback` state দেখাতে বাধ্য করতে পারে।
56
+
*`flushSync`পেন্ডিং Effect গুলো রান করতে পারে এবং সিঙ্ক্রোনাসভাবে may run pending effects and synchronously apply any updates they contain before returning.
57
+
*`flushSync`প্রয়োজনে কলব্যাকের ভিতরের আপডেট flush করার জন্য কলব্যাকের বাইরে আপডেট flush করতে পারে। যেমন, যদি কোন একটি ক্লিক থেকে কোন আপডেট পেন্ডীং থাকে, React কলব্যাকের ভিতরের আপডেট flush করার আগে ওগুলো flush করতে পারে।
58
58
59
59
---
60
60
61
-
## Usage {/*usage*/}
61
+
## ব্যবহার {/*usage*/}
62
62
63
-
### Flushing updates for third-party integrations {/*flushing-updates-for-third-party-integrations*/}
63
+
### থার্ড পার্টি ইন্টিগ্রেশনের জন্য flushing updates {/*flushing-updates-for-third-party-integrations*/}
64
64
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:
65
+
যখন থার্ড-পার্টি কোড যেমন ব্রাউজার API বা UI লাইব্রেরির সাথে ইন্টিগ্রেট করা হয়, React কে আপডেট flush করার জন্য বাধ্য করার প্রয়োজন পড়তে পারে। কলব্যাকের মধ্যে যেকোন <CodeStepstep={1}>state আপডেটের</CodeStep> synchronously flush করার জন্য React কে বাধ্য করতে `flushSync` ব্যবহার করুনঃ
66
66
67
67
```js [[1, 2, "setSomething(123)"]]
68
68
flushSync(() => {
@@ -71,15 +71,15 @@ flushSync(() => {
71
71
// By this line, the DOM is updated.
72
72
```
73
73
74
-
This ensures that, by the time the next line of code runs, React has already updated the DOM.
74
+
এটা নিশ্চিত করে যে, যতক্ষণে এর পরের লাইনের কোড রান হচ্ছে, ততক্ষণে যেন React DOM আপডেট করে ফেলে।
75
75
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.
76
+
**`flushSync`এর ব্যবহার বিরল, এর নিয়মিত ব্যবহার আপনার অ্যাপের পারফরম্যান্স উল্লেখযোগ্য ভাবে কমিয়ে ফেলতে পারে।**যদি আপনার অ্যাপ কেবল মাত্র React APIs ব্যবহার করে, এবং থার্ড পার্টি লাইব্রেরির সাথে ইন্টিগ্রেট না করে, `flushSync`এর প্রয়োজন হবার কথা না।
77
77
78
-
However, it can be helpful for integrating with third-party code like browser APIs.
78
+
তবে, ব্রাউজার API এর মত থার্ড পার্টি কোডের সাথে ইন্টিগ্রেশনের জন্য এটা কাজে লাগতে পারে।
79
79
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.
80
+
কিছু ব্রাউজার API প্রত্যাশা করে কলব্যাকের মধ্যকার রেজাল্ট DOM এ সিঙ্ক্রোনাসভাবে লেখা হয়ে যাবে, কলব্যাক শেষ হবার আগেই, যাতে ব্রাউজার রেন্ডার হওয়া DOM ব্যবহার করে কিছু করতে পারে। বেশিরাভগ ক্ষেত্রে React এটা আপনার জন্য স্বয়ংক্রিয়ভাবে হ্যান্ডেল করবে। কিন্তু কিছু কিছু ক্ষেত্রে একটা সিঙ্ক্রোনাস আপডেট জোর করে করা জরুরী হতে পারে।
81
81
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":
82
+
উদাহরণস্বরূপ, ব্রাউজার `onbeforeprint` API আপনাকে প্রিন্ট ডায়ালগ খুলার ঠিক আগ মুহুর্তে পেইজ বদলাতে দেয়। যেসব কাস্টম প্রিন্ট স্টাইল ডকুমেন্টের প্রিন্টিং সুন্দর করে ডিসপ্লে করতে দেয় সেগুলো এপ্লাই করার জন্য এটা কাজে লাগে। নিচের উদাহরণে, `onbeforeprint` কলব্যাকের মধ্যে DOM এ তৎক্ষণাৎ React state "flush" করে দেবার জন্য `flushSync` ব্যবহার করুন। তারপর, যতক্ষণে প্রিন্ট ডায়ালগ খুলছে, `isPrinting` "yes" দেখাবে।
83
83
84
84
<Sandpack>
85
85
@@ -122,12 +122,12 @@ export default function PrintApp() {
122
122
123
123
</Sandpack>
124
124
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.
125
+
`flushSync` ব্যতীত, প্রিন্ট ডায়ালগ `isPrinting`কে "no" হিসেবে দেখাবে। এর কারণ React আপডেটগুলোকে asynchronous ভাবে ব্যাচ করে এবং state আপডেট হবার আগেই প্রিন্ট ডায়ালগ দেখা যায়।
126
126
127
127
<Pitfall>
128
128
129
-
`flushSync`can significantly hurt performance, and may unexpectedly force pending Suspense boundaries to show their fallback state.
129
+
`flushSync`পারফরম্যান্স উল্লেখযোগ্য ভাবে কমিয়ে ফেলতে পারে, এবং পেন্ডীং সাসপেন্স বাউন্ডারিগুলোকে অপ্রত্যাশিতভাবে তাদের ফলব্যাক state দেখাতে বাধ্য করতে পারে।
130
130
131
-
Most of the time, `flushSync`can be avoided, so use`flushSync`as a last resort.
131
+
বেশির ভাগ সময়, `flushSync`এর ব্যবহার এড়িয়ে চলা যায়।`flushSync`কে ব্যবহার করুন last resort হিসেবে।
0 commit comments