Scroll the window to the top. scrollToTop() calls
window.scrollTo({ top: 0, behavior: 'auto' }). Part of
pota/use/scroll.
Wire scrollToTop to a button so a long page can jump back to the top
on click.
import { render } from 'pota'
import { scrollToTop } from 'pota/use/scroll'
function App() {
return (
<>
<div style={{ height: '200vh' }}>Long page</div>
<button on:click={scrollToTop}>Back to top</button>
</>
)
}
render(App)