Skip to content

helper to adjust priority #13

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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