Skip to content

Use if statement instead of ternary #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/guide/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,21 @@ With React's JSX, there are minor differences from HTML, such as using `classNam
Take this example below:

``` jsx
render () {
const { items } = this.props

render() {
let { items } = this.props

let children
if (items.length > 0) {
children = items.map(item =>
<li key={item.id}>{item.name}</li>
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing parens without a beginning :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typed it on iPhone so maybe I missed something but this paren should correspond to opening items.map(.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait nevermind haha, you are right

} else {
children = <p>No items found.</p>
}

return (
<div className='list-container'>
{items.length
? <ul>
{items.map(item => <li key={item.id}>{item.name}</li>)}
</ul>
: <p>No items found.</p>
}
{children}
</div>
)
}
Expand Down