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: beta/src/pages/learn/conditional-rendering.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -452,9 +452,9 @@ export default function PackingList() {
452
452
453
453
<Challenges>
454
454
455
-
### Show an icon for incomplete items with `? :` {/*show-an-icon-for-incomplete-items-with--*/}
455
+
### अधूरे आइटम के लिए `? :` के साथ एक आइकन दिखाएं {/*show-an-icon-for-incomplete-items-with--*/}
456
456
457
-
Use the conditional operator (`cond ? a : b`) to render a ❌ if `isPacked` isn’t `true`.
457
+
एक ❌ रेंडर करने के लिए कंडीशनल ऑपरेटर (`cond ? a : b`) का इस्तेमाल करें अगर `isPacked` `true` नहीं है।
458
458
459
459
<Sandpack>
460
460
@@ -532,15 +532,15 @@ export default function PackingList() {
532
532
533
533
</Solution>
534
534
535
-
### Show the item importance with `&&` {/*show-the-item-importance-with-*/}
535
+
### आइटम का इम्पोर्टेंस `&&` के साथ दिखाएं {/*show-the-item-importance-with-*/}
536
536
537
-
In this example, each `Item` receives a numerical `importance` prop. Use the `&&` operator to render "_(Importance: X)_" in italics, but only for items that have non-zero difficulty. Your item list should end up looking like this:
537
+
इस उदाहरण में, प्रत्येक `Item` को एक संख्यात्मक `importance` prop प्राप्त होता है। इटैलिक में "_(Importance: X)_" रेंडर करने के लिए `&&` ऑपरेटर का उपयोग करें, लेकिन केवल उन आइटम्स के लिए जिनमें गैर-शून्य कठिनाई है। आपकी आइटम सूची इस तरह दिखनी चाहिए:
538
538
539
539
* Space suit _(Importance: 9)_
540
540
* Helmet with a golden leaf
541
541
* Photo of Tam _(Importance: 6)_
542
542
543
-
Don't forget to add a space between the two labels!
543
+
दो लेबलों के बीच एक स्पेस जोड़ना न भूलें!
544
544
545
545
<Sandpack>
546
546
@@ -580,7 +580,7 @@ export default function PackingList() {
580
580
581
581
<Solution>
582
582
583
-
This should do the trick:
583
+
यह काम कर जाना चाहिए:
584
584
585
585
<Sandpack>
586
586
@@ -622,15 +622,15 @@ export default function PackingList() {
622
622
623
623
</Sandpack>
624
624
625
-
Note that you must write `importance > 0 && ...`rather than`importance && ...`so that if the`importance`is `0`, `0`isn't rendered as the result!
625
+
ध्यान दें कि आपको `importance && ...` के बजाय `importance > 0 && ...` लिखना होगा ताकि अगर `importance` `0` हो, तो `0` परिणाम के रूप में रेंडर नहीं हो!
626
626
627
-
In this solution, two separate conditions are used to insert a space between then name and the importance label. Alternatively, you could use a fragment with a leading space: `importance > 0 && <> <i>...</i></>` or add a space immediately inside the `<i>`: `importance > 0 && <i> ...</i>`.
627
+
इस समाधान में, नाम और इम्पोर्टेंस लेबल के बीच एक स्पेस डालने के लिए दो अलग-अलग कंडीशंस का उपयोग किया गया है। वैकल्पिक रूप से, आप एक प्रमुख स्पेस के साथ एक फ्रेगमेंट का उपयोग कर सकते हैं: `importance > 0 && <> <i>...</i></>` या `<i>` के अंदर तुरंत एक स्पेस जोड़ें: `importance > 0 && <i> ...</i>`।
628
628
629
629
</Solution>
630
630
631
-
### Refactor a series of `? :` to `if` and variables {/*refactor-a-series-of---to-if-and-variables*/}
631
+
### रिफैक्टर करे एक सीरीज `? :` से `if` और वेरिएबल्स {/*refactor-a-series-of---to-if-and-variables*/}
632
632
633
-
This `Drink` component uses a series of `? :` conditions to show different information depending on whether the `name` prop is `"tea"` or `"coffee"`. The problem is that the information about each drink is spread across multiple conditions. Refactor this code to use a single `if` statement instead of three `? :` conditions.
633
+
यह `Drink` कौम्पोनॅन्ट `? :` कंडीशंस की एक सीरीज का उपयोग करता है `name` prop `"tea"` या `"coffee"` के आधार पर अलग-अलग जानकारी दिखाने क लिए। समस्या यह है कि प्रत्येक ड्रिंक के बारे में जानकारी कई कंडीशंस में फैली हुई है। तीन `? :` कंडीशंस के बजाय एक `if` स्टेटमेंट का उपयोग करने के लिए इस कोड को दोबारा रिफैक्टर करे।
634
634
635
635
<Sandpack>
636
636
@@ -663,11 +663,11 @@ export default function DrinkList() {
663
663
664
664
</Sandpack>
665
665
666
-
Once you've refactored the code to use `if`, do you have further ideas on how to simplify it?
666
+
एक बार जब आप `if` का उपयोग कर क कोड को रिफैक्टर कर लेते हैं, तो क्या आपके पास इसे सरल बनाने के बारे में और विचार हैं?
667
667
668
668
<Solution>
669
669
670
-
There are multiple ways you could go about this, but here is one starting point:
670
+
इसके बारे में आप कई तरीके अपना सकते हैं, लेकिन यहां एक प्रारंभिक बिंदु है:
671
671
672
672
<Sandpack>
673
673
@@ -710,9 +710,9 @@ export default function DrinkList() {
710
710
711
711
</Sandpack>
712
712
713
-
Here the information about each drink is grouped together instead of being spread across multiple conditions. This makes it easier to add more drinks in the future.
713
+
यहां प्रत्येक ड्रिंक के बारे में जानकारी को कई स्थितियों में फैलाने के बजाय एक साथ समूहीकृत किया जाता है। इससे भविष्य में और ड्रिंक जोड़ना आसान हो जाता है।
714
714
715
-
Another solution would be to remove the condition altogether by moving the information into objects:
715
+
एक अन्य उपाय यह होगा कि जानकारी को ऑब्जेक्ट्स में स्थानांतरित करके कंडीशन को पूरी तरह से हटा दिया जाए:
0 commit comments