Conditional Rendering Components in React

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น • 7

  • @ImDrewL
    @ImDrewL ปีที่แล้ว

    Great video love how you explain the ternary operator in depth using if else statements as examples of other ways to do the same logic

  • @mehrosenasir9974
    @mehrosenasir9974 ปีที่แล้ว

    Hey Sam, these videos are helpful. I have a question though.
    Similar to what you did with Add A New Joke, I made an update button to update an existing joke. The only difference is when the update button gets called, it passes down an id of the joke to the onClickHandler in the App component, which I'm then storing in a local variable to later update the joke when the form's submit button gets clicked.
    The problem is that I can see the id in the onClickHandler function by consoling it out, but when I use the variable that holds the value in the onSubmitHandler , it is undefined when iterating over the jokes array.
    This problem is solved when using a state variable, however, I'm not using the id to render anything just to iterate over the array.

  • @dereksniper
    @dereksniper 8 หลายเดือนก่อน

    can conditional rendering be done using signals?

  • @zaibalo
    @zaibalo 2 ปีที่แล้ว +2

    Up until this ternary statement, React seemed actually really beatiful😆

  • @jhondoe2785
    @jhondoe2785 ปีที่แล้ว

    nice tutorial ❤

  • @theZ3r0CooL
    @theZ3r0CooL 2 ปีที่แล้ว

    Isn’t it such that if/else and ternary will return the else in cases of falsey, but the double ampersand will return nothing in cases of false, but the value of the condition in cases of falsey since a falsey still has a value; such as 0 or NaN for example? Meaning a ternary is truly the shorthand of that if/else and not the &&.

  • @கார்த்திகேயன்-ந9ழ

    Clean code ☺️☺️☺️