1import { useScroll } from "passport-ui";
1const hasScrolled = useScroll(10);2 3if (hasScrolled) {4 // Add a shadow to the header5}
A hook to detect if the page or a specific element has been scrolled.
Import the component from the passport-ui package.
1import { useScroll } from "passport-ui";
Basic example showing how to use the component.
1const hasScrolled = useScroll(10);2 3if (hasScrolled) {4 // Add a shadow to the header5}
Documentation and examples are available in Storybook.