File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
examples/load-more-infinite-scroll Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,15 @@ export default function useIntersectionObserver({
88 rootMargin = '0px' ,
99} ) {
1010 React . useEffect ( ( ) => {
11- const observer = new IntersectionObserver ( onIntersect , {
12- root : root && root . current ,
13- rootMargin,
14- threshold,
15- } )
11+ const observer = new IntersectionObserver (
12+ entries =>
13+ entries . forEach ( entry => entry . isIntersecting && onIntersect ( ) ) ,
14+ {
15+ root : root && root . current ,
16+ rootMargin,
17+ threshold,
18+ }
19+ )
1620
1721 const el = target && target . current
1822
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export default () => {
3232
3333 useIntersectionObserver ( {
3434 target : loadMoreButtonRef ,
35- onIntersect : ( ) => fetchMore ( ) ,
35+ onIntersect : fetchMore ,
3636 } )
3737
3838 return (
You can’t perform that action at this time.
0 commit comments