Open
Description
In a lot of cases, the priority of an update is based on whether an element is in the viewport or not.
With a simple helper function, we can make it more convenient to define it properly.
const MyComponent = () => {
const element = useRef(null);
const scroll = useScroll({
priority: createViewportPriorityUpdater(element),
});
return <div ref={ref} />;
};