Answers for "how to scroll to top of the page in react"

6

scroll to top in react

componentDidMount() {
  window.scrollTo(0, 0)
}
Posted by: Guest on August-28-2020
2

scroll to top in react

useEffect(() => {
  window.scrollTo(0, 0)
}, [])
Posted by: Guest on August-28-2020
0

react scroll to top

const scrollTop = () =>{   window.scrollTo({top: 0, behavior: 'smooth'});};
Posted by: Guest on May-15-2021

Code answers related to "how to scroll to top of the page in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language