HomeInterview QuestionsDo not show any button to load more data; instead,…

Do not show any button to load more data; instead, keep showing data as the user scrolls.

🟡 Medium Conceptual Junior level
1Times asked
Apr 2026Last seen
Apr 2026First seen

💡 Model Answer

To implement infinite scrolling without a "Load More" button, I would use lazy loading combined with pagination. The core idea is to fetch a page of data when the user reaches the bottom of the current list. In modern browsers, the IntersectionObserver API is ideal: I place a sentinel element at the end of the list and observe it. When the sentinel enters the viewport, I trigger an API call for the next page. I append the new items to the existing list and remove the sentinel, then re‑attach it. This approach keeps the DOM size manageable by optionally unmounting items that are far above the viewport. I also add a loading indicator while fetching and handle errors gracefully. Performance considerations include debouncing the scroll trigger, using requestAnimationFrame for DOM updates, and caching responses. For mobile, I ensure the threshold is slightly higher to account for touch scrolling. This pattern provides a seamless user experience, mimicking native app behavior while keeping the UI simple.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500