Skip to content

rootMargin doesn't work when root default to null #32

@iamyoki

Description

@iamyoki

See this example in codesandbox

https://codesandbox.io/s/try-react-infinite-scroll-hook-4ekfj1?file=/src/App.jsx:1374-1384

This is a common pitfall when using rootMargin without root specified

Little rules of Interception Observer API
root default to viewport while the viewport doesn't have any margin, so set rootMargin to any value will always fallback to 0px .

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