scroll to top in react
snippet in javascript

scroll to top in react

user111

componentDidMount() {
  window.scrollTo(0, 0)
}

scroll to top in react

user8883

useEffect(() => {
  window.scrollTo(0, 0)
}, [])