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
This is because transitions are non-blocking, but updating an input in response to the change event should happen synchronously. If you want to run a transition in response to typing, you have two options:
1618
+
এর কারণ হল ট্রানজিশনগুলি নন-ব্লকিং, কিন্তু change ইভেন্টের রেসপন্সে ইনপুট আপডেট করা অবশ্যই synchronous হওয়া উচিত। যদি আপনি টাইপ করার সময় একটি ট্রানজিশন চালাতে চান, তাহলে আপনার দুটি বিকল্প উপায় রয়েছে:
1619
1619
1620
-
1. You can declare two separate state variables: one for the input state (which always updates synchronously), and one that you will update in a transition. This lets you control the input using the synchronous state, and pass the transition state variable (which will "lag behind" the input) to the rest of your rendering logic.
1621
-
2. Alternatively, you can have one state variable, and add [`useDeferredValue`](/reference/react/useDeferredValue) which will "lag behind" the real value. It will trigger non-blocking re-renders to "catch up" with the new value automatically.
1620
+
১. আপনি দুটি আলাদা state ভেরিয়েবল ঘোষণা করতে পারেন: একটি ইনপুট state এর জন্য (যা সর্বদা synchronously আপডেট হয়), এবং একটি যা আপনি ট্রানজিশনে আপডেট করবেন। এটি আপনাকে synchronous state ব্যবহার করে ইনপুট নিয়ন্ত্রণ করতে দেয়, এবং বাকি রেন্ডারিং লজিকে ট্রানজিশন state ভেরিয়েবল (যা ইনপুটের পিছনে "বিলম্বিত" হবে) পাস করতে দেয়।
1621
+
২. বিকল্প হিসেবে, আপনি একটি state ভেরিয়েবল রাখতে পারেন, এবং [`useDeferredValue`](/reference/react/useDeferredValue) যোগ করতে পারেন যা বাস্তব মানের পিছনে "বিলম্বিত" হবে। এটি নতুন মানের সাথে "মেলে যাওয়ার" জন্য নন-ব্লকিং রি-রেন্ডারগুলি স্বয়ংক্রিয়ভাবে ট্রিগার করবে।
1622
1622
1623
1623
---
1624
1624
1625
-
### React doesn't treat my state update as a transition {/*react-doesnt-treat-my-state-update-as-a-transition*/}
1625
+
### React আমার state আপডেটকে ট্রানজিশন হিসেবে গ্রহণ করে না {/*react-doesnt-treat-my-state-update-as-a-transition*/}
1626
1626
1627
-
When you wrap a state update in a transition, make sure that it happens *during* the `startTransition`call:
1627
+
যখন আপনি একটি state আপডেটকে ট্রানজিশনে মোড়ান, নিশ্চিত করুন যে এটি `startTransition`কলের *সময়* ঘটে:
1628
1628
1629
1629
```js
1630
1630
startTransition(() => {
@@ -1633,9 +1633,9 @@ startTransition(() => {
1633
1633
});
1634
1634
```
1635
1635
1636
-
The function you pass to `startTransition` must be synchronous.
1636
+
`startTransition` এ আপনি যে ফাংশন পাস করবেন তা অবশ্যই synchronous হতে হবে।
1637
1637
1638
-
You can't mark an update as a transition like this:
1638
+
আপনি এভাবে একটি আপডেটকে ট্রানজিশন হিসেবে চিহ্নিত করতে পারবেন না:
1639
1639
1640
1640
```js
1641
1641
startTransition(() => {
@@ -1646,7 +1646,7 @@ startTransition(() => {
1646
1646
});
1647
1647
```
1648
1648
1649
-
Instead, you could do this:
1649
+
বরং, আপনি এটি করতে পারেন:
1650
1650
1651
1651
```js
1652
1652
setTimeout(() => {
@@ -1657,7 +1657,7 @@ setTimeout(() => {
1657
1657
}, 1000);
1658
1658
```
1659
1659
1660
-
Similarly, you can't mark an update as a transition like this:
1660
+
একইভাবে, আপনি একটি আপডেটকে এইরকম ট্রানজিশন হিসেবে চিহ্নিত করতে পারবেন না:
### I want to call `useTransition`from outside a component {/*i-want-to-call-usetransition-from-outside-a-component*/}
1682
+
### আমি একটি কম্পোনেন্টের বাইরে থেকে `useTransition`কল করতে চাই {/*i-want-to-call-usetransition-from-outside-a-component*/}
1683
1683
1684
-
You can't call `useTransition`outside a component because it's a Hook. In this case, use the standalone [`startTransition`](/reference/react/startTransition) method instead. It works the same way, but it doesn't provide the `isPending`indicator.
1684
+
আপনি একটি কম্পোনেন্টের বাইরে থেকে `useTransition`কল করতে পারবেন না কারণ এটি একটি Hook। এই ক্ষেত্রে, এর পরিবর্তে standalone [`startTransition`](/reference/react/startTransition) পদ্ধতি ব্যবহার করুন। এটি একইভাবে কাজ করে, কিন্তু এটি `isPending`ইন্ডিকেটর প্রদান করে না।
1685
1685
1686
1686
---
1687
1687
1688
-
### The function I pass to `startTransition` executes immediately {/*the-function-i-pass-to-starttransition-executes-immediately*/}
1688
+
### আমি যে ফাংশন `startTransition`-এ পাস করি তা তাৎক্ষণিকভাবে কার্যকর হয় {/*the-function-i-pass-to-starttransition-executes-immediately*/}
1689
1689
1690
-
If you run this code, it will print 1, 2, 3:
1690
+
আপনি যদি এই কোডটি চালান, তা 1, 2, 3 প্রিন্ট করবে:
1691
1691
1692
1692
```js {1,3,6}
1693
1693
console.log(1);
@@ -1698,7 +1698,7 @@ startTransition(() => {
1698
1698
console.log(3);
1699
1699
```
1700
1700
1701
-
**It is expected to print 1, 2, 3.** The function you pass to `startTransition` does not get delayed. Unlike with the browser `setTimeout`, it does not run the callback later. React executes your function immediately, but any state updates scheduled *while it is running* are marked as transitions. You can imagine that it works like this:
1701
+
**এটি 1, 2, 3 প্রিন্ট করার জন্য প্রত্যাশিত।** `startTransition`-এ আপনি যে ফাংশন পাস করেন তা দেরি হয় না। browser-এর`setTimeout`-এর মতো, এটি পরে কলব্যাক চালায় না। React আপনার ফাংশনটি তাৎক্ষণিকভাবে কার্যকর করে, কিন্তু *এটি চালানোর সময়* নির্ধারিত কোনো state আপডেটগুলি ট্রানজিশন হিসাবে চিহ্নিত হয়। এটি এভাবে কাজ করে বলে আপনি কল্পনা করতে পারেন:
0 commit comments