Hooks
useScrollTo
Programmatically scroll the window to a target element's offset top. SSR-safe: returns a no-op scrollToTop on the server.
import { useScrollTo } from "@empreint/ui";
import { useRef } from "react";
const target = useRef<HTMLDivElement>(null);
const { scrollToTop } = useScrollTo(target);
<button onClick={scrollToTop}>Back to top</button>
<div ref={target}>Top of section</div>Parameters
Prop
Type
Returns
Prop
Type