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

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -