Nowβs the time! Finally, we are ready to implement the Infinite Scroll.
We want to load more content as users scroll down. Here, we can use loadMoreButton as a landmark. When loadMoreButton appears in view, we click it, so it loads the next set of content.
const observer = new IntersectionObserver(entries => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.click() } })})
observer.observe(loadMoreButton)And thatβs it!
Welcome! Unfortunately, you donβt have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson