Skip to content

Commit 6f322a4

Browse files
authored
Update conditional-rendering.md (#1175)
The ternary syntax using parenthesis was an unconventional prettier invention, going out of its way to format react ternaries differently from normal ternaries (if i remember correctly, because vim users had trouble re-formating without a mouse). If they made the right decision or not is one thing, but the additional noise could mislead beginners here, thinking they have to add more characters to make a simple 2-slot ternary, or that it is a "react thing".
1 parent 970e90a commit 6f322a4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

content/docs/conditional-rendering.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,10 @@ render() {
176176
const isLoggedIn = this.state.isLoggedIn;
177177
return (
178178
<div>
179-
{isLoggedIn ? (
180-
<LogoutButton onClick={this.handleLogoutClick} />
181-
) : (
182-
<LoginButton onClick={this.handleLoginClick} />
183-
)}
179+
{isLoggedIn
180+
? <LogoutButton onClick={this.handleLogoutClick} />
181+
: <LoginButton onClick={this.handleLoginClick} />
182+
}
184183
</div>
185184
);
186185
}

0 commit comments

Comments
 (0)