Skip to content

helper to adjust priority #13

Open
@garthenweb

Description

@garthenweb

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} />;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions