import debounce from 'lodash.debounce';class Searchbox extends React.Component { constructor(props) { super(props); this.handleChange = this.handleChange.bind(this);this.emitChangeDebounced = debounce(this.emitChange, 250); // wait 250ms before next input } componentWillUnmount() { this.emitChangeDebounced.cancel(); } render() { return ( ); } handleChange(e) { this.emitChangeDebounced(e.target.value); } emitChange(value) { this.props.onChange(value); }}