Reputation: 21575
Here is a fiddle with the example demonstrating this code:
render: function() {
return (
<FormControl componentClass="select" onChange={console.log("changed")}>
<option value="1">A</option>
<option value="2">B</option>
</FormControl>
);
}
onChange()
is invoked only when my component gets rendered.
I want to react on a different option. So if I change 'A' to 'B' I want the component to fire onChange()
event. What am I missing?
Upvotes: 1
Views: 1182
Reputation: 1808
Write a method named handleSelectChange
handleSelectChange: function(event) {
//Do sth
}
and call it like
onChange={this.handleSelectChange}
Upvotes: 1