How can I perform a debounce?
@lebyy▲ 0 net votes
Problem: How do you perform debounce in React? I want to debounce the handleOnChange function. I tried with debounce(this.handleOnChange, 200) , but it doesn't work. function debounce(fn, delay) { var timer = null; return function() { var context = this, args =… Fix (from the top answer): 2019: try hooks + promise debouncing This is the most up-to-date version of how I would solve this problem. I would use: awesome-debounce-promise to debounce the async function use-constant to store that debounced function into the component react-async-hook to get the result into my component This is some initial…