Skip to content

Commit 7afc1d4

Browse files
authored
Merge pull request reactjs#686 from EarthSchlange/patch-a-little-more-concise-657
Adds Ternary Operator to Make Example Concise Issue reactjs#657
2 parents b4e9e0f + a2e445b commit 7afc1d4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

content/docs/conditional-rendering.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ class LoginControl extends React.Component {
9292
9393
render() {
9494
const isLoggedIn = this.state.isLoggedIn;
95-
96-
let button = null;
97-
if (isLoggedIn) {
98-
button = <LogoutButton onClick={this.handleLogoutClick} />;
99-
} else {
100-
button = <LoginButton onClick={this.handleLoginClick} />;
101-
}
95+
96+
let button = isLoggedIn ? (
97+
<LogoutButton onClick={this.handleLogoutClick} />
98+
) : (
99+
<LoginButton onClick={this.handleLoginClick} />
100+
);
102101
103102
return (
104103
<div>

0 commit comments

Comments
 (0)