Skip to content

Instantly share code, notes, and snippets.

@chris-kobrzak
Last active January 13, 2017 18:35
Show Gist options
  • Save chris-kobrzak/e1721578ce8f6402726f5277f8b63e32 to your computer and use it in GitHub Desktop.
Save chris-kobrzak/e1721578ce8f6402726f5277f8b63e32 to your computer and use it in GitHub Desktop.
Demonstrate poor practice of JSX intertwined with logic, coupled with multi-line ternary operator statements
render () {
const { visible } = this.props
return (
<div className={ visible ? 'expanded' : 'collapsed' }>
{
visible ? <div>
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
// Dozens of lines of JSX code here
</div> : null // <- null is a code smell!
}
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment