how to scroll smoothly in to the top in react js
function App() {
const myRef = createRef()
function scroll(ref) {
ref.current.scrollIntoView({ behavior: 'smooth' })
}
return (
<div className="App scrollToHere" ref={myRef}>
Content...
.....
.....
<button onClick={() => scroll(myRef)}>top</button>
</div>
)
}