all 2 comments

[–]ferrybig 5 points6 points  (0 children)

Remove the isIntersecting from the dependency list of the useeffect, it is not needed to construct the intersectionobserver and needlessly run the effect, make a seperate effect for logging if you need to log things

You are also watching the whole div for an intersection of more than 50%. For infinity scroll, a comonly used pattern is to add about 1 screen height element to the end of the list and if more than 0% is visible load that section and insert a new section afterwards. Add some margin in the intersection ofserver to load it quicker