774 shaares
10 private links
10 private links
What problems can happen when you use && to conditionally render content in JSX
I was reading the Quick Start - React and they mention:
If you prefer more compact code, you can use the conditional ? operator. Unlike if, it works inside JSX.
When you don’t need the else branch, you can also use a shorter logical && syntax.
But this article explains why we should always use the conditional ? operator instead.