const [isReached, setIsReached] = useState({ top: false, bottom: false });
<div
onScroll={(e: any) => {
const top = e.target.scrollTop === 0;
const bottom =
e.target.scrollHeight - e.target.scrollTop ===
e.target.clientHeight;
setIsReached({ bottom: bottom, top: top });
}}
/>
const [isReached, setIsReached] = useState({ top: false, bottom: false });
<div
onScroll={(e: any) => {
const top = e.target.scrollTop === 0;
const bottom =
e.target.scrollHeight - e.target.scrollTop ===
e.target.clientHeight;
setIsReached({ bottom: bottom, top: top });
}}
/>