Closed realph closed 7 years ago
When I type inside my input field the onChange event is firing correctly, however when I click outside of the input field it also fires the onChange event.
onChange
My code looks like this:
search(query) { console.log('onChange fired'); } render() { return ( <DebounceInput minLength={2} debounceTimeout={300} onChange={ this.search } placeholder="Search..." /> ); }
Any idea why this might be happening? I had a look at the CodePen example and it doesn't seem to fire when clicking outside of the input.
Any help is appreciated. Thanks in advance!
Oh that is intended behaviour. There is a flag (defaults to true) for this. https://github.com/nkbt/react-debounce-input#forcenotifyonblur-proptypesbool-default-true
true
@nkbt Missed this option. Thanks!
When I type inside my input field the
onChange
event is firing correctly, however when I click outside of the input field it also fires theonChange
event.My code looks like this:
Any idea why this might be happening? I had a look at the CodePen example and it doesn't seem to fire when clicking outside of the input.
Any help is appreciated. Thanks in advance!