0
Was ist der richtige Weg, um Inline-Klick-Listener in reagieren zu entfernen?Inline-Listener in Reaktion entfernen
var ClickComponent = React.createClass({
render: function() {
return (<div onClick={this.onClickStuff} className="orange noselect">
Click me {this.state.clicks || ''}
</div>);
},
getInitialState: function() {
return {
clicks: 0
};
},
onClickStuff: function (e) {
this.setState({
clicks: this.state.clicks + 1
});
if(10 < this.state.clicks){
// remove listener
}
}
});