useInView
Whether an element is on screen, from an IntersectionObserver. Pick a topic with it, so components stream full detail only while they're visible.
Usage
The guide is Dashboards of many runs.
Parameters
Returns
true while the element intersects the viewport, inside any scrolling containers it's in.
Behavior
- Clipping. The viewport is the root, and scrolling containers clip it, so a card scrolled out of a panel counts as off screen.
- Changing options. A new
rootMarginorthresholdstarts a new observer. - Without
IntersectionObserver. It stays atinitial. Every current browser has it.