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
The `useReducer`Hook is similar to `useState`—you must pass it an initial state and it returns a stateful value and a way to set state (in this case, the dispatch function). But it's a little different.
480
+
`useReducer`হুকটি অনেকটা `useState` মতো—আপনার অবশ্যই একে একটি initial state (স্টেটের প্রাথমিক ভ্যালু) পাস করতে হবে আর এটি return করে state এর ভ্যালু এবং state কে সেট করার একটি পদ্ধতি (এক্ষেত্রে, dispatch ফাংশন)। কিন্তু এটি (`useState` থেকে) একটু আলাদা।
481
481
482
-
The `useReducer`Hook takes two arguments:
482
+
`useReducer`হুকটি দুটি argument নেয়:
483
483
484
-
1.A reducer function
485
-
2.An initial state
484
+
1.একটি reducer function
485
+
2.একটি initial state
486
486
487
-
And it returns:
487
+
আর এটি return করে:
488
488
489
-
1.A stateful value
490
-
2.A dispatch function (to "dispatch" user actions to the reducer)
489
+
1.একটি state ভ্যালু
490
+
2.একটি dispatch function (ইউজার actions কে reducer এর নিকট "dispatch বা প্রেরণ" করার জন্য)
491
491
492
-
Now it's fully wired up! Here, the reducer is declared at the bottom of the component file:
492
+
এখন এটিকে পুরোপুরি সেট আপ করা হয়ে গেছে। এখানে, reducer টিকে component file এর নিচের দিকে declare করা হয়েছে:
493
493
494
494
<Sandpack>
495
495
@@ -674,7 +674,7 @@ li {
674
674
675
675
</Sandpack>
676
676
677
-
If you want, you can even move the reducer to a different file:
677
+
যদি চান, তাহলে আপনি reducer টিকে ভিন্ন আরেকটি ফাইলেও নিতে পারেন:
678
678
679
679
<Sandpack>
680
680
@@ -862,7 +862,7 @@ li {
862
862
863
863
</Sandpack>
864
864
865
-
Component logic can be easier to read when you separate concerns like this. Now the event handlers only specify _what happened_ by dispatching actions, and the reducer function determines _how the state updates_ in response to them.
865
+
যখন আপনি এমন করে separation of concern বজায় রাখবেন, কম্পোনেন্ট লজিক পড়াটা তখন সহজতর হবে। এখন event handler গুলো actions কে dispatch (প্রেরণ) করার মাধ্যমে শুধু _কি ঘটলো_ সেটা নির্ধারণ করে, আর তার জবাবে reducer function টি নির্ধারণ করে _কিভাবে state টি update হয়_।
866
866
867
867
## Comparing `useState` and `useReducer` {/*comparing-usestate-and-usereducer*/}
0 commit comments