ankeetmaini / react-infinite-scroll-component

An awesome Infinite Scroll component in react.
https://react-infinite-scroll-component.netlify.com/
MIT License
2.88k stars 323 forks source link

How to maintain scrolling position? #355

Open JoeLim13 opened 2 years ago

JoeLim13 commented 2 years ago

How to maintain scrolling position after clicking back button on browser from one of the links clicked in the mapped infinite scrolling list?

carlos-dubon commented 7 months ago

you need to cache the fetched data somewhere. like in a global state. when you go back you retrieve the cached data and it should (assuming you have implemented scroll history. next.js has an experimental flag and does this for you)