Browse Source

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".
main
Paul Henschel 5 years ago
committed by GitHub
parent
commit
6f322a438a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      content/docs/conditional-rendering.md

9
content/docs/conditional-rendering.md

@ -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>
);
}

Loading…
Cancel
Save