We know the most functional part of scroll event are deltaY, deltaX
and what good use would lodash do for you, if it eats out these attributes on debouce.
So here is a custom debouce which resolve this issue
let timer;
let debounce = (func, timeout = 500) => {
return ({ deltaY, deltaX } = args) => {
clearTimeout(timer);
let newArgs = { deltaY, deltaX }
timer = setTimeout(() => { func.call(this, newArgs); }, timeout); }; }
return (
<div onWheel={debounce(this.wheelDetect, 500)}> yellow </div>
)