Dan Abramov
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
6 deletions
-
content/docs/conditional-rendering.md
|
|
@ -92,12 +92,13 @@ class LoginControl extends React.Component { |
|
|
|
|
|
|
|
render() { |
|
|
|
const isLoggedIn = this.state.isLoggedIn; |
|
|
|
|
|
|
|
const button = isLoggedIn ? ( |
|
|
|
<LogoutButton onClick={this.handleLogoutClick} /> |
|
|
|
) : ( |
|
|
|
<LoginButton onClick={this.handleLoginClick} /> |
|
|
|
); |
|
|
|
let button; |
|
|
|
|
|
|
|
if (isLoggedIn) { |
|
|
|
button = <LogoutButton onClick={this.handleLogoutClick} />; |
|
|
|
} else { |
|
|
|
button = <LoginButton onClick={this.handleLoginClick} /> |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<div> |
|
|
|