The expression in isTrue is re-evaluated every time any value used in the expression changes. When the results of the expression change, it triggers a re-rendering of the component. Use aura:renderIf if you expect to show the components for both the true and false states, and it would require a server round trip to instantiate the components that aren't initially rendered. Switching condition unrenders current branch and renders the other. Otherwise, use aura:if instead if you want to instantiate the components in either its body or the else attribute, but not both.
<aura:component> <aura:renderIf isTrue="{!v.truthy}"> True <aura:set attribute="else"> False </aura:set> </aura:renderIf> </aura:component>
Attribute Name | Attribute Type | Description | Required? |
---|---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
else | Component[] | The alternative content to render when isTrue evaluates to false, and the body is not rendered. Set using the <aura:set> tag. | |
isTrue | Boolean | An expression that must evaluate to true to display the body of the component. | Yes |