Skip to content

Commit d1e8b52

Browse files
committed
Adds Ternary Operator to Make Example Concise Issue reactjs#657
1 parent c091475 commit d1e8b52

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

content/docs/conditional-rendering.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@ class LoginControl extends React.Component {
9393
render() {
9494
const isLoggedIn = this.state.isLoggedIn;
9595
96-
let button = null;
97-
if (isLoggedIn) {
98-
button = <LogoutButton onClick={this.handleLogoutClick} />;
99-
} else {
100-
button = <LoginButton onClick={this.handleLoginClick} />;
101-
}
96+
let button = isLoggedIn
97+
? <LogoutButton onClick={this.handleLogoutClick} />
98+
: <LoginButton onClick={this.handleLoginClick} />;
10299
103100
return (
104101
<div>

0 commit comments

Comments
 (0)