Update conditional-rendering.md (#1175)

The ternary syntax using parenthesis was an unconventional prettier invention, going out of its way to format react ternaries differently from normal ternaries (if i remember correctly, because vim users had trouble re-formating without a mouse). If they made the right decision or not is one thing, but the additional noise could mislead beginners here, thinking they have to add more characters to make a simple 2-slot ternary, or that it is a "react thing".
This commit is contained in:
Paul Henschel
2020-03-09 19:30:53 +01:00
committed by GitHub
parent 970e90a4e6
commit 6f322a438a

View File

@@ -176,11 +176,10 @@ render() {
const isLoggedIn = this.state.isLoggedIn;
return (
<div>
{isLoggedIn ? (
<LogoutButton onClick={this.handleLogoutClick} />
) : (
<LoginButton onClick={this.handleLoginClick} />
)}
{isLoggedIn
? <LogoutButton onClick={this.handleLogoutClick} />
: <LoginButton onClick={this.handleLoginClick} />
}
</div>
);
}