Created
February 22, 2017 10:42
-
-
Save aquajach/e45ac2e9c5bd28bc096f5ed201ca88a8 to your computer and use it in GitHub Desktop.
CoffeeScript => ES6 + JSX
This file contains hidden or 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
// 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