loktar00/react-lazy-load

Allow passing a root prop to IntersectionObserver

Open

#169 opened on Oct 18, 2023

 (0 comments) (1 reaction) (0 assignees)TypeScript (163 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (981 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

If using this on elements inside a scrollable div, you need to pass the root prop in order for the offset to work correctly. Otherwise offset is "ignored" and elements are only "visible" when they are actually visibile.

We just need a new root prop of type Element that can be passed optionally to the IntersectionObserver constructor

Contributor guide