How can I write an else if structure using React (JSX) - the ternary is not expressive enough

前端 未结 6 1670
情话喂你
情话喂你 2021-01-01 18:47

I want to write the equivalent in react:

if (this.props.conditionA) {
    Condition A
} else if (this.props.conditionB) {
    

        
6条回答
  •  -上瘾入骨i
    2021-01-01 19:27

    If any one still facing this issue, please paste below line in your eslintrc.js file.

    "no-nested-ternary" : "off" 
    

    This will allow you to start using nested ternary in your jsx code.

提交回复
热议问题