Reputation: 502
I'm trying to apply a ternary operator on this block of code and insert another if the condition is false. I find it a bit confusing because I've never used a ternary operator in this type of code blocks.
Thanks in advance!
Code:
{isNormalLoader && (
<Dimmer active inverted>
<Loader size="medium">{!textDisabled && loadingText}</Loader>
</Dimmer>
)}
If the condition is false, display other component, but I don't have any clue on how to do it.
Upvotes: 0
Views: 46
Reputation: 22510
You could do like this
{condition ? trueComponent : falseComponent}
For Your code:
{isNormalLoader ? <Dimmer active inverted><Loader size="medium">{!textDisabled && loadingText}</Loader></Dimmer> : <ForFalseComponent/>}
Upvotes: 3