I haven’t figured out how to do this to any level of success yet.
Any reason why this function sendVote()
never gets fired at the onClick event?
class RadioRows extends Component {
constructor(props) {
super(props);
this.state = {
currentVoteResponse: '',
currentPollId: this.props.pollId
}
}
sendVote(){
console.log("You selected: this.props.resp=" + this.props.resp);
var resp = this.props.resp;
}
render(){
return (
<div className="responseBox">
<label><input key={this.props.key} name="megha"
onClick={this.sendVote.bind(this)}
type="radio"
placeholder="bawa"
value={this.props.resp} />
 {this.props.resp}
</label> 
current score: {this.props.votes}
</div>
);
}
}
RadioRows.propTypes = {
resp: PropTypes.string.isRequired,
votes: PropTypes.number.isRequired,
sendVote: PropTypes.func.isRequired
};