in my project I want change the scrollY when user click some button,I tryed change initialScrollY use the useState hooks,but it does not work 🙁
my code like this
const [initialScrollY, setInitialScrollY] = useState(0);
useEffect(() => {
if (searchParams?.get('filter')) {
setInitialScrollY(300);
} else {
setInitialScrollY(0);
}
}, [searchParams]);
<InfiniteScroll
initialScrollY={initialScrollY}
dataLength={searchList.length}
next={getSearchListMore}
hasMore={hasMore}
loader={<SearchListSkeleton />}
hasChildren
scrollableTarget="scrollableDiv"
className="flex-1 flex-grow overflow-y-scroll no-scrollbar"
height="calc(100vh - 96px)"
>
......
</InfiniteScroll>
New contributor
user25117457 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.