1.0.1 • Published 2 years ago
usethrottle-hook v1.0.1
useThrottle hook for React
homepage: https://www.npmjs.com/package/usethrottle-hook;
npm i usethrottle-hook
Usage example
const throttleLoadMore = useThrottle(() => props.loadMore(dataLength), 500); ... function handleScroll(e: React.UIEvent<HTMLElement>) { ... let scrollBottom = element.scrollHeight - element.offsetHeight - element.scrollTop; if (dataLength < countLimit) { if (Math.floor(scrollBottom) <= 0) {
throttleLoadMore();
}
}
}