Skip to content

Change how refs are set #13

Description

@james2406

Hey, thanks for creating such a lightweight/performant library! I think this library could improve on its api slightly to make it easier to use in an application using refs. Instead of returning a ref as the first return value, it would be more flexible if it could be passed in as the first argument to useDimensions:

const containerRef = useRef(null);
const dimensions =  useDimensions(containerRef);

This would make it easier to work with other libraries, such as useScrolling:

const containerRef = useRef(null);
const dimensions =  useDimensions(containerRef);
const scrolling = useScrolling(containerRef);

I would be more than happy to make a PR for this change, however, I understand if you wouldn’t want to introduce this change as it would be breaking.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions