const handleScroll = (e) => { const reachedBottom = Math.ceil(e.target.scrollTop + e.target.clientHeight) >= e.target.scrollHeight; if (reachedBottom) { // do something } };