Skip to content

Instantly share code, notes, and snippets.

@miketamis
Forked from Jtmaca9/new.js
Last active February 18, 2016 04:16
Show Gist options
  • Save miketamis/9f181247af47f946825d to your computer and use it in GitHub Desktop.
Save miketamis/9f181247af47f946825d to your computer and use it in GitHub Desktop.
var React = require('react');
var VoteWords = React.createClass({
getInitialState: function(){
return{
votes: []
}
},
componentDidMount: function(){
var self = this;
// if(self.props.voteWords != self.state.votes){
// self.setState({votes: self.props.voteWords});
// debugger;
// }
},
renderVotes: function(votes){
return votes.map(function(vote) {
return <div><a className="btn btn-primary">{vote.word}<span className="badge">{vote.count}</span></a></div>
});
},
render: function(){
return (
<div>
{this.renderVotes(this.props.voteWords)}
</div>
)
}
});
module.exports = VoteWords;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment