Open 17dun opened 6 months ago
`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={
....`
my code like this
I haven't tried this prop, but we can use ref on the container and do something like
ref.current.scrollTop = 0
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 :(