Skip to content

Commit c9e99c8

Browse files
authored
Avoid unnecessary ternary
1 parent c70187c commit c9e99c8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

content/docs/conditional-rendering.md

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

0 commit comments

Comments
 (0)