useInView
Whether an element is in the viewport, from an IntersectionObserver.
For lazy sections, "load more" sentinels, reading progress and reveal effects. With once, it stops observing after the element is first seen.
Usage
Examples
Load a section when it is reached
"Load more" sentinel with a button
API
6 options
3 return values
Accessibility
Never hide content until it scrolls into view for readers without JavaScript or with reduced motion; keep "load more" available as a real button too.
Notes
- Set initialInView to true for content that must render without JavaScript.