DO YOU KNOW? Infinite scroll can be implemented in two ways in react if you're not considering the third party libraries. 1. attaching the scroll event listener and calculation the window offset.
2. by using the browser api intersection observer that sits and observes the sentinel div if it is visible on the view port or not.
Advantage of using the sentinel div and intersection observer method is that it will only trigger when the sentinel div is visible on the view port unlike the scroll event listener that will be triggered every time the scroll event happens in that component or page.
while creating a giphy clone project inspired by Piyush Agarwal I've implemented this method for loading more gifs across the project. DO CHECK IT OUT. ILL UPLOAD A VIDEO SOON FOR THE SAME. #clevercoderjoy #react #javascript