Skip to content

Instantly share code, notes, and snippets.

@OlavHN
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OlavHN/982bce14f7ecbceba967 to your computer and use it in GitHub Desktop.
Save OlavHN/982bce14f7ecbceba967 to your computer and use it in GitHub Desktop.
var Summary1 = React.createClass({
render: function(() {
var cards = this.props.cards
return (
<div>
<Notification />
<div>
cards.map(function(card, i) {
return <Card key={'key' + i} data={card}>
})
</div>
</div>
)
})
})
var Summary2 = react.createClass({
render: function() {
return (
<div>
<Notification />
<div>
{this.props.children}
</div>
</div>
)
}
})
React.renderComponent(<Summary1 cards=[1,2,3,4] />, document.body)
// or ..
React.renderComponent(
<Summary2>
<Card data={1} />
<Card data={2} />
<Card data={3} />
<Card data={4} />
</Summary2>, document.body)
// never renderComponent into a DOM element alreadt owned by a another react app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment