The ternary operator is used to conditionally render the elements in React. It is similar to if...else
statement.
condition ? true : false
function Example() {
const show = true;
return (
<>
{show ? (
<h1>This is show component</h1>
) : (
<h1>This is no show component</h1>
)}
</>
);
}