In this lesson you will learn yet another way of using short circuit operator in JavaScript on the basis of React conditional rendering example
Hey, useful tip, but it's also good to mention that not all falsy values are working that way in this "short circuit" notation.
For example if you have some value of type number
and you use that notation to decide whether to render the element or not, you might see 0
being rendered when the condition
is falsy
Totally valid point! Forgot to mention this caveat, thanks for pointing out👍🏼 Nullish coalescence operator will be even easier and more predictable to use when it hits support for all of the browsers.