Dynamically scroll to top in React JS components. Handling the scroll position in a react app on route change
Just import the component, use like other components
import DynamicScrollToTop from `DynamicScrollToTop.js`
return(<DynamicScrollTop scrollType="smooth" />);
// react's hook
useEffect(() => {
window.scroll(0, 0)
})
For more details Visit Dynamically Scrol to Top - Original
Note: Below are the links for more details on location
and scroll