mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
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:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user