Skip to content

Commit 73486dd

Browse files
committed
feat: ✨ Finished 67%
- translated step 3 full
1 parent 2287825 commit 73486dd

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/content/learn/extracting-state-logic-into-a-reducer.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -457,39 +457,39 @@ export default function tasksReducer(tasks, action) {
457457

458458
</DeepDive>
459459

460-
### Step 3: Use the reducer from your component {/*step-3-use-the-reducer-from-your-component*/}
460+
### ধাপ ৩: আপনার কম্পোনেন্টে reducer টি ব্যাবহার করুন {/*step-3-use-the-reducer-from-your-component*/}
461461

462-
Finally, you need to hook up the `tasksReducer` to your component. Import the `useReducer` Hook from React:
462+
সবশেষে, আপনার `tasksReducer` টিকে আপনার কম্পোনেন্টের সাথে সংযুক্ত করে দিতে হবে। React থেকে `useReducer` হুকটি import করুন:
463463

464464
```js
465465
import { useReducer } from 'react';
466466
```
467467

468-
Then you can replace `useState`:
468+
অতঃপর আপনি `useState` কে সরিয়ে দিতে পারেন:
469469

470470
```js
471471
const [tasks, setTasks] = useState(initialTasks);
472472
```
473473

474-
with `useReducer` like so:
474+
`useReducer` দিয়ে, ঠিক এভাবে:
475475

476476
```js
477477
const [tasks, dispatch] = useReducer(tasksReducer, initialTasks);
478478
```
479479

480-
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` থেকে) একটু আলাদা।
481481

482-
The `useReducer` Hook takes two arguments:
482+
`useReducer` হুকটি দুটি argument নেয়:
483483

484-
1. A reducer function
485-
2. An initial state
484+
1. একটি reducer function
485+
2. একটি initial state
486486

487-
And it returns:
487+
আর এটি return করে:
488488

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 বা প্রেরণ" করার জন্য)
491491

492-
Now it's fully wired up! Here, the reducer is declared at the bottom of the component file:
492+
এখন এটিকে পুরোপুরি সেট আপ করা হয়ে গেছে। এখানে, reducer টিকে component file এর নিচের দিকে declare করা হয়েছে:
493493

494494
<Sandpack>
495495

@@ -674,7 +674,7 @@ li {
674674

675675
</Sandpack>
676676

677-
If you want, you can even move the reducer to a different file:
677+
যদি চান, তাহলে আপনি reducer টিকে ভিন্ন আরেকটি ফাইলেও নিতে পারেন:
678678

679679
<Sandpack>
680680

@@ -862,7 +862,7 @@ li {
862862

863863
</Sandpack>
864864

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 হয়_
866866

867867
## Comparing `useState` and `useReducer` {/*comparing-usestate-and-usereducer*/}
868868

0 commit comments

Comments
 (0)