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

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -