javascript - REACT JSX - Chained conditons -
the following code works me , gives me expected results have doubts if doing right.
{ conditon1?<childcomponent />:condition2?<p>hi</p>:<p>bye</p> }
my concern chained conditional statement - valid?
yes code statement wrote fine , work, prefer use better indentation while writing nested conditions other person reads code better understanding. when have more chained conditions, prefer using if/else rather ternary operators.
Comments
Post a Comment