Выполните debounce в React.js

Как вы выполняете debounce в React.js?

Я хочу разоблачить handleOnChange.

Я пробовал сdebounce(this.handleOnChange, 200) но это не работает

function debounce(fn, delay) {
  var timer = null;
  return function () {
    var context = this, args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function () {
      fn.apply(context, args);
    }, delay);
  };
}
var SearchBox = React.createClass({

    render:function () {
    return (
    <input  type="search" name="p"
       onChange={this.handleOnChange}/>
    );
    },
    handleOnChange: function (event) {
       //make ajax call
    }
});

Ответы на вопрос(20)

Ваш ответ на вопрос