Can we write ternary operator in DIV tag on LWC as below.
<div class = if:true= {showleftDiv} ? slds-size_4-of-6 : slds-size_4-of-6 >
Can we write ternary operator in DIV tag on LWC as below.
<div class = if:true= {showleftDiv} ? slds-size_4-of-6 : slds-size_4-of-6 >
You need to move all the expressions into js. This is done on purpose to make the code more testable as mentioned in documentation
Example
Html
<div class={divClass}></div>
JS
get divClass() {
return this.showleftDiv ? 'slds-size_4-of-6' : 'slds-size_6-of-6';
}