How to add smooth scrolling back to top button using reactjs?

Posted by Prem Tiwari | Updated on

If you want to add smooth scrolling back to top button using reactjs? First, we need to track the page as it’s scrolled in the state of the component. This tracking should only be happening while the component is mounted. This can be done like so:

Then we need to render the component:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers