Skip to content

Instantly share code, notes, and snippets.

@dandelany
Created May 4, 2015 15:32
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 dandelany/ffc5cfeabdbcb6f31554 to your computer and use it in GitHub Desktop.
Save dandelany/ffc5cfeabdbcb6f31554 to your computer and use it in GitHub Desktop.
var _ = require('lodash');
var React = require('react/addons');
var Testing = React.createClass({
getInitialState() {
return { count: 0 }
},
onClick() {
this.setState({count: this.state.count+1});
},
render: function() {
return <div onClick={this.onClick}>
<button>Click me</button>
<br/>
{this.state.count} rabbits
{_.map(_.range(this.state.count*100), function() {
return <img style={{position: 'absolute', top: Math.random() * 500, left: Math.random() * 1000}} src="http://fc03.deviantart.net/fs70/i/2012/095/4/6/free_bunny_icon_lineart_by_kennadee-d4v3l9e.gif" alt=""/>
})}
</div>
}
});
module.exports = Testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment