Skip to content

Instantly share code, notes, and snippets.

@Jtmaca9
Created February 18, 2016 04:15
Show Gist options
  • Save Jtmaca9/afc1488da0bd05525da8 to your computer and use it in GitHub Desktop.
Save Jtmaca9/afc1488da0bd05525da8 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){
var v = [];
for(words in votes){
v.push(<div><a className="btn btn-primary">{words.word}<span className="badge">{words.count}</span></a></div>);
debugger;
}
console.log(votes);
return v;
},
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