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/useContext.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: useContext
4
4
5
5
<Intro>
6
6
7
-
`useContext`is a React Hook that lets you read and subscribe to [context](/learn/passing-data-deeply-with-context)from your component.
7
+
`useContext`হচ্ছে একটি React হুক যেটা আপনাকে কম্পোনেন্ট থেকে [context](/learn/passing-data-deeply-with-context)পড়তে এবং সাবস্কাইব করতে দিবে।
8
8
9
9
```js
10
10
constvalue=useContext(SomeContext)
@@ -16,11 +16,11 @@ const value = useContext(SomeContext)
16
16
17
17
---
18
18
19
-
## Reference {/*reference*/}
19
+
## রেফারেন্স {/*reference*/}
20
20
21
21
### `useContext(SomeContext)` {/*usecontext*/}
22
22
23
-
Call `useContext` at the top level of your component to read and subscribe to [context.](/learn/passing-data-deeply-with-context)
23
+
[context](/learn/passing-data-deeply-with-context) রিড করা এবং সেখানে সাবস্ক্রাইব করার জন্য `useContext` কে আপনার কম্পোনেন্ট এর একেবারে উপরের স্তরে কল করতে হবে।
24
24
25
25
```js
26
26
import { useContext } from'react';
@@ -30,21 +30,21 @@ function MyComponent() {
30
30
// ...
31
31
```
32
32
33
-
[See more examples below.](#usage)
33
+
[নীচে আরো উদাহরণ দেখুন।](#usage)
34
34
35
-
#### Parameters {/*parameters*/}
35
+
#### প্যারামিটারস {/*parameters*/}
36
36
37
-
* `SomeContext`: The context that you've previously created with [`createContext`](/reference/react/createContext). The context itself does not hold the information, it only represents the kind of information you can provide or read from components.
37
+
* `SomeContext`: এটি হচ্ছে সেই context যেটি আপনি আগে [`createContext`](/reference/react/createContext) ব্যবহার করে তৈরি করেছিলেন। context নিজে থেকে তথ্য ধারণ করে না, এটি শুধুমাত্র সেই তথ্যগুলিকেই উপস্থাপন করে যা আপনি দিতে পারেন অথবা কম্পোনেন্ট থেকে রিড করতে পারেন।
38
38
39
-
#### Returns {/*returns*/}
39
+
#### রিটার্নস {/*returns*/}
40
40
41
-
`useContext`returns the context value for the calling component. It is determined as the `value` passed to the closest `SomeContext.Provider`above the calling component in the tree. If there is no such provider, then the returned value will be the `defaultValue`you have passed to [`createContext`](/reference/react/createContext) for that context. The returned value is always up-to-date. React automatically re-renders components that read some context if it changes.
41
+
যে কম্পোনেন্টে `useContext` কল করা হয় তার জন্য context এর ভ্যালু রিটার্ন করে। যে কম্পোনেন্ট কল করা হয়েছে তার উপরে কম্পোনেন্ট ট্রির সব থেকে কাছের `SomeContext.Provider` দ্বারা নির্ধারিত হয় যা `value` হিসাবে পাঠানো হয়। যদি এমন কোন provider না থাকে, তাহলে তার রিটার্ন করা মান হবে `defaultValue` যা আপনি context এর জন্য [`createContext`](/reference/react/createContext) এ পাঠিয়েছিলেন। রিটার্ন্ড মান সবসময় আপ টু ডেট হবে। যদি context এ কোন পরিবর্তন হয়, তাহলে context ব্যবহারকৃত কম্পোনেন্টগুলোকে React স্বয়ংক্রিয়ভাবে পুনরায় রেন্ডার করবে।
42
42
43
-
#### Caveats {/*caveats*/}
43
+
#### সতর্কতা {/*caveats*/}
44
44
45
-
* `useContext()`call in a component is not affected by providers returned from the *same* component. The corresponding `<Context.Provider>`**needs to be *above*** the component doing the `useContext()` call.
46
-
* React **automatically re-renders** all the children that use a particular context starting from the provider that receives a different `value`. The previous and the next values are compared with the [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) comparison. Skipping re-renders with [`memo`](/reference/react/memo) does not prevent the children receiving fresh context values.
47
-
* If your build system produces duplicates modules in the output (which can happen with symlinks), this can break context. Passing something via context only works if `SomeContext` that you use to provide context and `SomeContext`that you use to read it are ***exactly* the same object**, as determined by a `===`comparison.
45
+
* একটি কম্পোনেন্টের ভিতর `useContext()`কল করা হলে সেই *একই* কম্পোনেন্ট থেকে রিটার্নড হওয়া providers দিয়ে এটি প্রভাবিত হবে না। যে কম্পোনেন্ট থেকে `useContext()` কল করা হয়েছে, সংশ্লিষ্ট `<Context.Provider>`কে সেই কম্পোনেন্টের ***উপরে* থাকতে হবে**
46
+
* provider এর শুরু থেকে যেসব চিলড্রেন একটি নির্দিষ্ট context ব্যবহার করে সেটি যখন ভিন্ন `মান` গ্রহণ করে তখন React সেসব চিলড্রেনকে **স্বয়ংক্রিয়ভাবে পুনরায় রেন্ডার** করে। আগের এবং পরের মান [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) এর মাধ্যমে তুলনা করা হয়। পুনরায় রেন্ডার এড়িয়ে যেতে যেসব চিলড্রেনে [`memo`](/reference/react/memo) ব্যবহার করা হয়, সেখানে context এর নতুন মান পেতে বাধা দেওয়া হয় না।
47
+
* যদি আপনার বিল্ড সিস্টেম আউটপুটে ডুপ্লিকেট মডিউল উৎপাদন করে (যা symlinks দ্বারা তৈরি হয়), তাহলে সেটা আপনার context কে ব্রেক করতে পারে। কোন কিছু যখন context এর মাধ্যমে পাঠানো হয়, সেটি শুধুমাত্র তখনই কাজ করবে যখন আপনার context প্রদান করার জন্য ব্যবহারকৃত `SomeContext`এবং রিড করার জন্য ব্যবহারকৃত `SomeContext`***হুবহু* একই object** হবে, যা `===`এর মাধ্যমে তুলনা করে নির্ধারিত হয়।
0 commit comments