r/learnreactjs • u/Justincy901 • May 22 '22
Question How to make entire div element disappear based on boolean value
I'm trying to do something like so.
` if (true):
show div
else
Don't show div or return null
How to do that in a return component function.
3
Upvotes
6
u/TechnicalDificulties May 22 '22
Use a short circuit expression
condition && <div></div>3
u/kortirso May 22 '22