Successfully added
React
by Patrik
Conditional (ternary) Operator (? :)
The conditional (ternary) operator is the only JavaScript operator that takes three operands. This operator is frequently used as a shortcut for the if statement.
Syntax: {cond ? <A /> : <B />} means “if cond, render <A />, otherwise <B />”.
Sample
{itemCollapsed ? (
<CommandItem title='Expand' />
) : (
<CommandItem title='Collapse' />
)}
Referenced in:
Comments