Browse Source

Merge pull request #686 from EarthSchlange/patch-a-little-more-concise-657

Adds Ternary Operator to Make Example Concise Issue #657
main
Alex Krolick 7 years ago
committed by GitHub
parent
commit
7afc1d4398
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      content/docs/conditional-rendering.md

13
content/docs/conditional-rendering.md

@ -92,13 +92,12 @@ class LoginControl extends React.Component {
render() { render() {
const isLoggedIn = this.state.isLoggedIn; const isLoggedIn = this.state.isLoggedIn;
let button = null; let button = isLoggedIn ? (
if (isLoggedIn) { <LogoutButton onClick={this.handleLogoutClick} />
button = <LogoutButton onClick={this.handleLogoutClick} />; ) : (
} else { <LoginButton onClick={this.handleLoginClick} />
button = <LoginButton onClick={this.handleLoginClick} />; );
}
return ( return (
<div> <div>

Loading…
Cancel
Save