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
+6-31Lines changed: 6 additions & 31 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
-
Bu React'a şunu söyler: "`<Section>` içindeki herhangi bir eleman,`LevelContext`'i istediğinde, ona bu `level` değerini ver." Bileşen, üzerindeki UI ağacında bulunan en yakın `<LevelContext.Provider>` değerini kullanır.
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
-
>>>>>>> 6326e7b1b9fa2a7e36a555792e2f1b97cfcf2669
479
+
Bu React'e şunu söyler: "Eğer bu `<Section>` içindeki herhangi bir bileşen `LevelContext` talep ederse, onlara bu `level` değerini ver." Bileşen, UI ağacındaki en yakın `<LevelContext>`'in değerini kullanacaktır.
Orijinal kodla aynı sonucu elde edersiniz, ancak her `Heading` bileşenine `level` prop'unu aktarmanız gerekmez! Bunun yerine, üstündeki en yakın `Section` bileşenine sorarak başlık seviyesini "bulur":
572
568
573
-
<<<<<<< HEAD
574
-
1.`level` prop'unu `<Section>`'a aktarırsınız.
575
-
2.`Section` alt bileşenlerini `<LevelContext.Provider value={level}>` sarmalar.
576
-
3.`Heading`, `useContext(LevelContext)` ile birlikte yukarıdaki en yakın `LevelContext`'e değerini sorar.
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
-
>>>>>>> 6326e7b1b9fa2a7e36a555792e2f1b97cfcf2669
569
+
1.`<Section>`'a bir `level` prop'u geçirirsiniz.
570
+
2.`Section`, çocuklarını `<LevelContext value={level}>` içine sarar.
571
+
3.`Heading`, `useContext(LevelContext)` ile yukarıdaki en yakın `LevelContext` değerini talep eder.
582
572
583
573
## Context değerini provider'ının tanımlandığı bileşende okuma {/*using-and-providing-context-from-the-same-component*/}
584
574
@@ -878,25 +868,14 @@ Genellikle, bazı bilgilere ağacın farklı bölümlerindeki bileşenler taraf
878
868
879
869
<Recap>
880
870
881
-
<<<<<<< HEAD
882
871
* Context, bir elemanın altındaki tüm ağaca bilgi aktarmasını sağlar.
883
-
* Context'i aktarmak için:
872
+
* Context geçirme:
884
873
1. `exportconstMyContext=createContext(defaultValue)` ile oluşturun ve dışa aktarın.
885
-
2. Farklı derinlikteki herhangi bir alt bileşenden okumak için `useContext(MyContext)` Hook'una aktarın.
874
+
2. Herhangi bir alt bileşende okumak için `useContext(MyContext)` Hook'unu geçirin.
886
875
3. Üst bileşenden değer sağlamak için, alt bileşenleri `<MyContext.Provider value={...}>` içine sarın.
887
876
* Context ortada bulunan herhangi bir elamandan aktarılır.
888
877
* Context, "çevresine adapte olan" bileşenler yazmanıza olanak sağlar.
889
878
* Context kullanmadan önce, prop olarak aktarmayı veya JSX'i `children` olarak iletmeyi deneyin.
890
-
=======
891
-
* Context lets a component provide some information to the entire tree below it.
892
-
* To pass context:
893
-
1. Create and export it with `exportconstMyContext=createContext(defaultValue)`.
894
-
2. Pass it to the `useContext(MyContext)` Hook to read it in any child component, no matter how deep.
895
-
3. Wrap children into `<MyContext value={...}>` to provide it from a parent.
896
-
* Context passes through any components in the middle.
897
-
* Context lets you write components that "adapt to their surroundings".
898
-
* Before you use context, try passing props or passing JSX as `children`.
899
-
>>>>>>> 6326e7b1b9fa2a7e36a555792e2f1b97cfcf2669
900
879
901
880
</Recap>
902
881
@@ -1047,11 +1026,7 @@ li {
1047
1026
1048
1027
`imageSize` prop'unu bütün bileşenlerden kaldırın.
1049
1028
1050
-
<<<<<<< HEAD
1051
1029
`Context.js` dosyasında `ImageSizeContext`'i oluşturun ve dışa aktarın. Ardından değeri aşağı aktarmak için `List`'i `<ImageSizeContext.Provider value={imageSize}>` ile sarın ve `useContext(ImageSizeContext)` kullanarak `PlaceImage` bileşeninde değerini okuyun:
1052
-
=======
1053
-
Create and export `ImageSizeContext` from `Context.js`. Then wrap the List into `<ImageSizeContext value={imageSize}>` to pass the value down, and `useContext(ImageSizeContext)` to read it in the `PlaceImage`:
0 commit comments