Started to learn zustand got problem in create function of zustand. Problem was weaker concept of callback and nested function . i think i am confident in these topics now.
If condition is true → use valueIfTrue If condition is false → use valueIfFalse ✅ Your amenity example Your code: {amenity === 'wifi' ? 'WIFI' : amenity} Breakdown: ✔ Condition: amenity === 'wifi' This checks: “Is the current amenity equal to 'wifi'?” ✔ If condition is TRUE → show: 'WIFI' ✔ If condition is FALSE → show: amenity ๐ฏ Example with your amenitiesList const amenitiesList = [ 'wifi' , 'parking' , 'kitchen' ]; Looping through each item: ๐น 1. amenity = "wifi" Check condition: 'wifi' === 'wifi' → TRUE So ternary returns: 'WIFI' ๐ Display: WIFI ๐น 2. amenity = "parking" Check condition: 'parking' === 'wifi' → FALSE So ternary returns: amenity // which is "parking" ๐ Display: parking ๐น 3. amenity = "kitchen" Check condition: 'kitchen' === 'wifi' → FALS...
Comments
Post a Comment