I'm trying to render multiple React components in a shorthand if, but it doesn't work as expected. This is my source:
render() {
const isLoggedin = true;
return (
<div>
{ isLoggedin ?
<Greeting />
<LogoutButton />
: <LoginButton />
}
</div>
);
}
If I just use one component, it works (for example remove Greeting):
render() {
const isLoggedin = true;
return (
<div>
{ isLoggedin ?
<LogoutButton />
: <LoginButton />
}
</div>
);
}
Is there a way to render both of them?