-
-
Save jsonnull/6a602ef094dd135f2dd690d1fe0b38d1 to your computer and use it in GitHub Desktop.
React render function organization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentComponent extends Component { | |
render() { | |
const {a, b, someBoolean, someList} = this.props; | |
const conditionalComponent = someBoolean ? <SomeComponent /> : null; | |
const listItems = someList.map(item => <ListItem item={item} />); | |
return ( | |
<div> | |
<div>A: {a}, B: {b}</div> | |
{conditionalComponent} | |
{listItems} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment