function MyComponent(){
let button;
if (isLoggedIn) {
button = <LogoutButton />;
} else {
button = <LoginButton />;
}
return (
<div>
{button}
</div>
);
}
Example:
{errorMessage && <p>{errorMessage}</p>}
Example 1:
{isLoggedIn
? <LogoutButton />
: <LoginButton />
}
Example 2:
{recipes.length > 0
? renderRecipes()
: <p>Sorry, no recipes. Click here to create the first one!</p>
}