Browse Source

Adds Ternary Operator to Make Example Concise Issue #657

main
Michael H 7 years ago
parent
commit
d1e8b526ae
  1. 9
      content/docs/conditional-rendering.md

9
content/docs/conditional-rendering.md

@ -93,12 +93,9 @@ 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} />; : <LoginButton onClick={this.handleLoginClick} />;
} else {
button = <LoginButton onClick={this.handleLoginClick} />;
}
return ( return (
<div> <div>

Loading…
Cancel
Save