I want to use the lodash debouce
method to improve the UX of a customer when they enter input in an input box. For some reason the debounce function isnt returning the value from the function been debounced.
Can anyone spot what may be wrong?
import debounce from "lodash/debounce";
render() {
const inputValid = () => {
console.log('triggered');
return this.state.input.length > 0;
};
let d = debounce(inputValid, 100);
d();
console.log(d()); // this gets logged as undefined although I
//thought it would be either true or false
return <input onChange="updateInput" value={this.state.input} />;
}