Scroll to top when React States Updates

Hello,

Is there a solution, to force the scroll bar to scroll to TOP when the React States Updates on useEffect() hook ?
I tried window.scrollTo(0, 0); but it didn’t worked.
Any help is appreciated.

Thanks every one from @ Ionic/React community developers.

Use scrollToTop() in your useEffect.

1 Like

Hello @mikrochipkid,

can you give me an example?

Thank you.

I found this solution on #Github from a #Discord channel, and it worked like a charm… I will mark this question as SOLVED:

https://stackoverflow.com/questions/58730178/adding-in-a-scroll-button-with-ionic-react