debounce onchange reactjs

var FreeText = React.createClass({
_onChange: function(e) {
this.setState({
freetext: e.target.value
}, function() {this._saveText(this.state.freetext)});
},
_saveText : function () {
console.log('saving...')
//do server call
},
componentWillMount: function() {
this._saveText = _.debounce(this._saveText, 500);
},
render: function(){
return(
<textarea
value={this.state.freetext}
onChange={this._onChange}
/>
)
}
})

it was so ugly , i had to write it down to save me (or anyone else) time next time you need to debounce a server call on reactjs.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.