Skip to content

Instantly share code, notes, and snippets.

@MicheleBertoli
Created February 19, 2016 15:47
Show Gist options
  • Save MicheleBertoli/4ef1fbe0736677a1e40d to your computer and use it in GitHub Desktop.
Save MicheleBertoli/4ef1fbe0736677a1e40d to your computer and use it in GitHub Desktop.
React Repeat
const App = React.createClass({
render() {
return (
<Repeat collection={[1, 2]}>
{item => <div>{item}</div>}
</Repeat>
);
}
});
const Repeat = React.createClass({
render() {
return <div>{this.props.collection.map(this.props.children)}</div>;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment