Skip to content

Instantly share code, notes, and snippets.

@aquajach
Created February 22, 2017 10:42
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 aquajach/e45ac2e9c5bd28bc096f5ed201ca88a8 to your computer and use it in GitHub Desktop.
Save aquajach/e45ac2e9c5bd28bc096f5ed201ca88a8 to your computer and use it in GitHub Desktop.
CoffeeScript => ES6 + JSX
// CoffeeScript:
// @CampaignList = React.createClass
//
// render: ->
// div { className: 'content-wrapper' },
// for campaign in @props.data
// React.createElement(CampaignCard,
// key: campaign.id
// campaign: campaign
// )
// ES6 + JSX
class CampaignList extends React.Component {
render() {
const campaign_cards = this.props.data.map(campaign => {
return <CampaignCard key={campaign.id} campaign={campaign}></CampaignCard>
});
return <div className="content-wrapper">
{campaign_cards}
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment