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/learn/thinking-in-react.md
+34-34Lines changed: 34 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,43 +237,43 @@ UI interactive করার জন্য আপনাকে ব্যবহা
237
237
238
238
<DeepDive>
239
239
240
-
#### Props vs State {/*props-vs-state*/}
240
+
#### Props বনাম State {/*props-vs-state*/}
241
241
242
-
There are two types of "model" data in React: props and state. The two are very different:
242
+
React-এ দু'ধরণের "model" ডেটা রয়েছেঃ props এবং state। এই দুইটা খুবই আলাদাঃ
243
243
244
-
*[**Props**are like arguments you pass](/learn/passing-props-to-a-component)to a function. They let a parent component pass data to a child component and customize its appearance. For example, a `Form` can pass a`color` prop to a `Button`.
245
-
*[**State**is like a component’s memory.](/learn/state-a-components-memory)It lets a component keep track of some information and change it in response to interactions. For example, a `Button` might keep track of `isHovered` state.
244
+
*[**Props**হচ্ছে একটা ফাংশনে আপনার pass করা argument এর মত।](/learn/passing-props-to-a-component)এরা একটা parent কম্পোনেন্ট থেকে child কম্পোনেন্টে এ ডেটা পাঠানোর এবং কাস্টমাইজ করার সুযোগ দেয়। উদাহরণস্বরূপ, একটা `Form`, একটা `Button` এ`color` prop পাঠাতে পারে।
245
+
*[**State**হচ্ছে কম্পোনেন্টের স্মৃতির মত।](/learn/state-a-components-memory)এটা একটা কম্পোনেন্টকে কোন একটা তথ্যের হালচাল হিসেব রাখার সুযোগ দেয় এবং ব্যবহারকারীর interaction অনুসারে বদলাতে দেয়। উদাহরণস্বরূপ, `Button`, `isHovered` state এর track রাখতে পারে।
246
246
247
-
Props and state are different, but they work together. A parent component will often keep some information in state (so that it can change it), and *pass it down* to child components as their props. It's okay if the difference still feels fuzzy on the first read. It takes a bit of practice for it to really stick!
247
+
Props এবং state আলাদা বটে, তবে এরা একই সাথে কাজ করে। একটা parent কম্পোনেন্ট বেশিরভাগ সময়ই কিছু তথ্য state এ রাখবে (যাতে সে এটা বদলাতে পারে), এবং prop হিসেবে child কম্পোনেন্টে *pass down* করবে। শুরুর দিকে যদি এই পার্থক্যটা একটু ঝামেলার মনে হয় সেটা খুব স্বাভাবিক। এটা মাথার মধ্যে গেঁথে যেতে বেশ চর্চ্চার দরকার পড়ে।
248
248
249
249
</DeepDive>
250
250
251
-
## Step 4: Identify where your state should live {/*step-4-identify-where-your-state-should-live*/}
251
+
## ধাপ ৪ঃ আপনার state কোথায় থাকা উচিত সেটা চিহ্নিত করুন। {/*step-4-identify-where-your-state-should-live*/}
252
252
253
-
After identifying your app’s minimal state data, you need to identify which component is responsible for changing this state, or *owns* the state. Remember: React uses one-way data flow, passing data down the component hierarchy from parent to child component. It may not be immediately clear which component should own what state. This can be challenging if you’re new to this concept, but you can figure it out by following these steps!
253
+
আপনার অ্যাপের ন্যূনতম state ডেটা চিহ্নিত করার পর, আপনাকে বের করতে হবে এর state পরিবর্তন কোন কম্পোনেন্টের দায়িত্ব, বা কে এই state এর *মালিকানা রাখে*। মনে রাখবেনঃ React একমুখী তথ্য প্রবাহ ব্যবহার করে, অর্থাৎ hierarchy-তে parent থেকে child কম্পোনেন্টের দিকে data pass হয়। কোন কম্পোনেন্টে state থাকা উচিত এইটা হয়ত প্রথমেই পরিষ্কার হবে না। আপনি যদি এই ধারণার সাথে নতুন নতুন পরিচিত হয়ে থাকেন, এটা একটু কঠিন লাগতে পারে, তবে নিচের ধাপগুলার মাধ্যমে আপনি আপনার উত্তর পেয়ে যাবেন।
254
254
255
-
For each piece of state in your application:
255
+
আপনার অ্যাপ্লিকেশনের প্রতিটা অংশের state-এর জন্যঃ
256
256
257
-
1.Identify *every* component that renders something based on that state.
258
-
2.Find their closest common parent component--a component above them all in the hierarchy.
259
-
3.Decide where the state should live:
260
-
1.Often, you can put the state directly into their common parent.
261
-
2.You can also put the state into some component above their common parent.
262
-
3.If you can't find a component where it makes sense to own the state, create a new component solely for holding the state and add it somewhere in the hierarchy above the common parent component.
257
+
1.সেই *প্রতিটি* কম্পোনেন্ট চিহ্নিত করুন যা ওই state এর উপর নির্ভর করে কিছু রেন্ডার করে।
258
+
2.তাদের সবচেয়ে কাছের সেই কম্পোনেন্ট খুঁজে বের করুন যা তাদের উভয়েরই parent -- একটি কম্পোনেন্ট যা hierarchy তে তাদের সবার উপরে।
259
+
3.state কোথায় থাকা উচিত সেটা সিদ্ধান্ত নিনঃ
260
+
1.বেশিরভাগ সময়ে, আপনি তাদের সাধারণ parent এ state রেখে দিতে পারবেন।
261
+
2.আপনি তাদের সাধারণ parent এর উপরের কোন কম্পোনেন্টেও state রাখতে পারেন।
262
+
3.আপনি যদি এমন কোন কম্পোনেন্ট খুঁজে না পান যেখানে state রাখা যুক্তিযুক্ত হবে, তাহলে নতুন একটা কম্পোনেন্ট তৈরি করুন শুধুমাত্র তাদের state রাখবার জন্য এবং hierarchy-তে তাদের সাধারণ parent এর উপরে কোথাও যুক্ত করে দিন।
263
263
264
-
In the previous step, you found two pieces of state in this application: the search input text, and the value of the checkbox. In this example, they always appear together, so it makes sense to put them into the same place.
264
+
এর আগের ধাপে অ্যাপ্লিকেশনে আপনি state হবার মত দুটি বিষয় পেয়েছিলেনঃ সার্চের জন্য ইনপুট টেক্সট এবং চেকবক্সের ভ্যালু। এই উদাহরণে, তারা সব সময়ে একই সাথে আসে, তাই তাদেরকে একই জায়গায় রাখাটা যুক্তিযুক্ত হবে।
265
265
266
-
Now let's run through our strategy for them:
266
+
এখন তাদের জন্য আমাদের পরিকল্পনা ঝালাই করে নিই।
267
267
268
-
1.**Identify components that use state:**
269
-
*`ProductTable` needs to filter the product list based on that state (search text and checkbox value).
270
-
*`SearchBar`needs to display that state (search text and checkbox value).
271
-
1.**Find their common parent:**The first parent component both components share is`FilterableProductTable`.
272
-
2.**Decide where the state lives**: We'll keep the filter text and checked state values in`FilterableProductTable`.
268
+
1.**state ব্যবহার করে এমন কম্পোনেন্টগুলো চিহ্নিত করুন**
269
+
*`ProductTable`কে ওই state(সার্চ টেক্সট এবং চেকবক্স) ব্যবহার করে পণ্যের তালিকা বাছাই করতে হবে।
270
+
*`SearchBar`কে ওই state(সার্চ টেক্সট এবং চেকবক্স) দেখাতে হবে।
271
+
1.**তাদের সাধারণ parent খুঁজে বের করুন**প্রথম যেই কম্পোনেন্ট এদের দুজনেরই parent তা হল`FilterableProductTable`।
272
+
2.**State কোথায় থাকবে সেটা সিদ্ধান্ত নিন**: আমরা বাছাই করা text এবং checked state ভ্যালুগুলো `FilterableProductTable` -তে রাখব।
273
273
274
-
So the state values will live in `FilterableProductTable`.
274
+
সুতরাং state ভ্যালুগুলো থাকবে `FilterableProductTable` এর মধ্যে।
275
275
276
-
Add state to the component with the [`useState()` Hook.](/reference/react/useState)Hooks are special functions that let you "hook into" React. Add two state variables at the top of `FilterableProductTable`and specify their initial state:
276
+
কম্পোনেন্টে [`useState()` Hook.](/reference/react/useState)ব্যবহার করে state যুক্ত করুন। Hook হচ্ছে বিশেষ ফাংশন যা আপনাকে Reac† এর "মায়ায় হারাতে" বাধ্য করবে। `FilterableProductTable`এর একদম উপরে দুটো state variable যুক্ত করুন এবং তাদের প্রাথমিক state ঠিক করে দিন।
277
277
278
278
```js
279
279
functionFilterableProductTable({ products }) {
@@ -437,15 +437,15 @@ td {
437
437
438
438
</Sandpack>
439
439
440
-
Notice that editing the form doesn't work yet. There is a console error in the sandbox above explaining why:
440
+
খেয়াল করুন form এর পরিবর্তন এখনো কাজ করে না। উপড়ে স্যান্ডবক্সে আমরা একটা কনসোল এরর দেখতে পাচ্ছি যেটা কারণটা ব্যাখ্যা করে।
441
441
442
442
<ConsoleBlock level="error">
443
443
444
-
You provided a \`value\`prop to a form field without an \`onChange\`handler. This will render a read-only field.
444
+
আপনি \`onChange\`handler নেই এমন একটা ফিল্ডে \`value\` prop পাঠিয়েছেন। এটা কেবলমাত্র একটি read-only ফিল্ড রেন্ডার করবে।
445
445
446
446
</ConsoleBlock>
447
447
448
-
In the sandbox above, `ProductTable` and `SearchBar`read the `filterText`and `inStockOnly`props to render the table, the input, and the checkbox. For example, here is how `SearchBar`populates the input value:
448
+
উপরের স্যান্ডবক্সে, টেবিল, ইনপুট এবং চেকবক্স দেখানোর জন্য `ProductTable`এবং `SearchBar`যথাক্রমে `filterText`এবং `inStockOnly`prop গুলো নজরে রাখে। উদাহরণস্বরূপ, নিচে দেখতে পাবেন কীভাবে `SearchBar`ইনপুটের ভ্যালুগুলোকে সামনে নিয়ে আসে।
449
449
450
450
```js {1,6}
451
451
functionSearchBar({ filterText, inStockOnly }) {
@@ -457,12 +457,12 @@ function SearchBar({ filterText, inStockOnly }) {
457
457
placeholder="Search..."/>
458
458
```
459
459
460
-
However, you haven't added any code to respond to the user actions like typing yet. This will be your final step.
460
+
কিন্তু আপনি এখনো ব্যবহারকারীর কোন কাজ যেমন টাইপিং এর ফলাফল দেখানোর জন্য কোড লিখেননি। এটা হবে আপনার সর্বশেষ ধাপ।
461
461
462
462
463
-
## Step 5: Add inverse data flow {/*step-5-add-inverse-data-flow*/}
463
+
## ধাপ ৫ঃ inverse data flow যুক্ত করুন {/*step-5-add-inverse-data-flow*/}
464
464
465
-
Currently your app renders correctly with props and state flowing down the hierarchy. But to change the state according to user input, you will need to support data flowing the other way: the form components deep in the hierarchy need to update the state in `FilterableProductTable`.
465
+
এখন hierarchy-তে props এবং state এর তথ্য সঠিকভাবে নিচের দিকে প্রবাহিত হওয়ায় আপনার অ্যাপ ঠিকঠাক দেখা যাচ্ছে। কিন্তু ব্যবহারকারীর দেওয়া তথ্যের ভিত্তিতে state পরিবর্তন করতে আপনাকে উল্টোটিকে তথ্য প্রবাহের ব্যবস্থা রাখতে হবেঃ hierarchy-র গভীরে থাকা কম্পোনেন্টগুলো দিয়ে `FilterableProductTable` এ থাকা state পরিবর্তন করবে হবে।
466
466
467
467
React makes this data flow explicit, but it requires a little more typing than two-way data binding. If you try to type or check the box in the example above, you'll see that React ignores your input. This is intentional. By writing `<input value={filterText} />`, you've set the `value` prop of the `input` to always be equal to the `filterText` state passed in from `FilterableProductTable`. Since `filterText` state is never set, the input never changes.
468
468
@@ -482,7 +482,7 @@ function FilterableProductTable({ products }) {
482
482
onInStockOnlyChange={setInStockOnly} />
483
483
```
484
484
485
-
Inside the `SearchBar`, you will add the `onChange` event handlers and set the parent state from them:
485
+
`SearchBar` এর মধ্যে আপনি `onChange` event handlers যুক্ত করবেন এবং তাদের থেকে parent state ঠিক করবেন।
486
486
487
487
```js {5}
488
488
<input
@@ -492,7 +492,7 @@ Inside the `SearchBar`, you will add the `onChange` event handlers and set the p
You can learn all about handling events and updating state in the [Adding Interactivity](/learn/adding-interactivity) section.
645
+
আপনি event handling এবং state আপডেটের খুঁটিনাটি [Interactivity সংযুক্তি](/learn/adding-interactivity) সেকশন থেকে শিখে নিতে পারবেন।
646
646
647
-
## Where to go from here {/*where-to-go-from-here*/}
647
+
## এখান থেকে কোথায় যাবেন? {/*where-to-go-from-here*/}
648
648
649
-
This was a very brief introduction to how to think about building components and applications with React. You can [start a React project](/learn/installation) right now or [dive deeper on all the syntax](/learn/describing-the-ui) used in this tutorial.
649
+
এটা ছিল React দিয়ে কীভাবে কম্পোনেন্ট এবং অ্যাপ্লিকেশন তৈরির বিষয়ে চিন্তা করতে হয় তার একটা সংক্ষেপিত পরিচিতি। আপনি এখুনি [একটি React প্রজেক্ট শুরু করতে পারেন](/learn/installation) অথবা এই টিউটোরিয়ালে ব্যবহৃত সকল [syntax নিয়ে গভীরভাবে জানতে পারেন।](/learn/describing-the-ui)
0 commit comments