Como rolar suavemente no topo em 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>
)
}
Real Rabbit