how to make the screen go on top react code example
Example 1: scroll to top in react
componentDidMount() {
window.scrollTo(0, 0)
}
Example 2: scroll to top in react
useEffect(() => {
window.scrollTo(0, 0)
}, [])
componentDidMount() {
window.scrollTo(0, 0)
}
useEffect(() => {
window.scrollTo(0, 0)
}, [])