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/passing-data-deeply-with-context.md
+5-26Lines changed: 5 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -476,11 +476,7 @@ export default function Section({ level, children }) {
476
476
}
477
477
```
478
478
479
-
<<<<<<< HEAD
480
-
এটা React কে বলে দেয় যে: "যদি এই `<Section>` এর ভিতরের কোনো কম্পোনেন্ট `LevelContext` তালাশ করে, তবে তাকে এই `level` দিয়ে দাও"। তখন কম্পোনেন্টটি UI ট্রি এর ভিতর এর সবচেয়ে কাছের `<LevelContext.Provider>` এর ভ্যালু ইউজ করবে।
481
-
=======
482
-
This tells React: "if any component inside this `<Section>` asks for `LevelContext`, give them this `level`." The component will use the value of the nearest `<LevelContext>` in the UI tree above it.
483
-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
479
+
এটা React কে বলে দেয় যে: "যদি এই `<Section>` এর ভিতরের কোনো কম্পোনেন্ট `LevelContext` তালাশ করে, তবে তাকে এই `level` দিয়ে দাও"। তখন কম্পোনেন্টটি UI ট্রি এর ভিতর এর উপরে থাকা সবচেয়ে কাছের `<LevelContext>` এর ভ্যালু ইউজ করবে।
ফলস্বরূপ আমরা অরিজিনাল কোডের মতো হুবহু ফলাফল পেলাম, কিন্তু আপনার `level` প্রপটিকে প্রত্যেক `Heading` কম্পোনেন্টে পাস করতে হয়নি! তার পরিবর্তে `Heading` কম্পোনেন্টটি এর হেডিং লেভেল, উপরস্থ সবচেয়ে কাছের `Section` থেকে "বুঝে নিতে" পারছে:
572
568
573
-
<<<<<<< HEAD
574
569
1. আপনি `<Section>` কে `level` প্রপ পাস করলেন।
575
-
2.`Section` এর চিলড্রেনকে `<LevelContext.Provider value={level}>` দিয়ে wrap করে নেয়।
576
-
3.`useContext(LevelContext)` এর দ্বারা `Heading` এর উপরস্থ নিকটতম `levelContext` এর ভ্যালু তালাশ করে।
577
-
=======
578
-
1. You pass a `level` prop to the `<Section>`.
579
-
2.`Section` wraps its children into `<LevelContext value={level}>`.
580
-
3.`Heading` asks the closest value of `LevelContext` above with `useContext(LevelContext)`.
581
-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
570
+
2.`Section` এর চিলড্রেনকে `<LevelContext value={level}>` দিয়ে wrap করে নেয়।
571
+
3.`useContext(LevelContext)` এর দ্বারা `Heading` এর উপরস্থ নিকটতম `LevelContext` এর ভ্যালু তালাশ করে।
582
572
583
573
## একই কম্পোনেন্ট থেকে কনটেক্সট Use এবং Provide করা {/*using-and-providing-context-from-the-same-component*/}
584
574
@@ -874,25 +864,14 @@ CSS এ, ভিন্ন ভিন্ন property যেমন `color` এবং
874
864
875
865
<Recap>
876
866
877
-
<<<<<<< HEAD
878
-
* কনটেক্সট একটি কম্পোনেন্টকে এর নিম্নস্থ পুরো ট্রি কে কিছু ইনফর্মেশন প্রোভাইড করতে দেয়।
867
+
* কনটেক্সট একটি কম্পোনেন্টকে এর নিম্নস্থ পুরো ট্রিকে কিছু ইনফর্মেশন প্রোভাইড করতে দেয়।
879
868
* কনটেক্সট পাস করতে হলে:
880
869
1. `exportconstMyContext=createContext(defaultValue)` দিয়ে কনটেক্সট create করে export করুন।
881
870
2. `useContext(MyContext)` হুককে কনটেক্সটটি পাস করুন যাতে যেকোনো চাইল্ড কম্পোনেন্ট থেকে সেটিকে read করা যায়, তা যত গভীরেই হোক না কেনো।
882
-
3. চিলড্রেনকে `<MyContext.Provider value={...}>` দিয়ে wrap করুন যাতে একটি প্যারেন্ট থেকে কনটেক্সটটি প্রোভাইড করতে পারেন।
871
+
3. চিলড্রেনকে `<MyContext value={...}>` দিয়ে wrap করুন যাতে একটি প্যারেন্ট থেকে কনটেক্সটটি প্রোভাইড করতে পারেন।
883
872
* কনটেক্সট মধ্যবর্তী যেকোনো কম্পোনেন্ট ভেদ করে যেতে পারে।
884
873
* কনটেক্সট আপনাকে এমন কম্পোনেন্ট তৈরি করতে দেয় যেগুলো "তাদের আসে পাশের সাথে তাল মিলিয়ে চলতে পারে"।
885
874
* কনটেক্সট ব্যবহার করার আগে, চেষ্টা করুন প্রপস পাস করতে বা JSX কে `children` হিসেবে পাস করতে।
886
-
=======
887
-
* Context lets a component provide some information to the entire tree below it.
888
-
* To pass context:
889
-
1. Create and export it with `exportconstMyContext=createContext(defaultValue)`.
890
-
2. Pass it to the `useContext(MyContext)` Hook to read it in any child component, no matter how deep.
891
-
3. Wrap children into `<MyContext value={...}>` to provide it from a parent.
892
-
* Context passes through any components in the middle.
893
-
* Context lets you write components that "adapt to their surroundings".
894
-
* Before you use context, try passing props or passing JSX as `children`.
0 commit comments