Skip to content

Latest commit

 

History

History
36 lines (21 loc) · 887 Bytes

File metadata and controls

36 lines (21 loc) · 887 Bytes

Dynamically Scroll to Top

Dynamically scroll to top in React JS components. Handling the scroll position in a react app on route change

Usage

Just import the component, use like other components

import DynamicScrollToTop from `DynamicScrollToTop.js`
return(<DynamicScrollTop scrollType="smooth" />);

One liner solution of Above Solution

// 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