mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Merge pull request #686 from EarthSchlange/patch-a-little-more-concise-657
Adds Ternary Operator to Make Example Concise Issue #657
This commit is contained in:
@@ -92,13 +92,12 @@ class LoginControl extends React.Component {
|
||||
|
||||
render() {
|
||||
const isLoggedIn = this.state.isLoggedIn;
|
||||
|
||||
let button = null;
|
||||
if (isLoggedIn) {
|
||||
button = <LogoutButton onClick={this.handleLogoutClick} />;
|
||||
} else {
|
||||
button = <LoginButton onClick={this.handleLoginClick} />;
|
||||
}
|
||||
|
||||
let button = isLoggedIn ? (
|
||||
<LogoutButton onClick={this.handleLogoutClick} />
|
||||
) : (
|
||||
<LoginButton onClick={this.handleLoginClick} />
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user