Skip to content

Instantly share code, notes, and snippets.

@eiri
Created August 19, 2015 02:09
Show Gist options
  • Save eiri/3e4791635b1fe2400a43 to your computer and use it in GitHub Desktop.
Save eiri/3e4791635b1fe2400a43 to your computer and use it in GitHub Desktop.
Cycle a list, emit two elements per one item.
var items = _.chain(this.state.docs)
.slice(0, 10)
.map(function(doc, idx) {
return [
React.createElement(ListDivider, {
key: 'div' + idx,
inset: false
}),
React.createElement(ListItem, {
key: 'item' + idx,
primaryText: doc.id,
secondaryText: doc.value.rev
})
];
})
.flatten(true)
.value();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment