Infinite Scrolling Service Catalog
At Urban Company, users often browse through a vast catalog of services offered by various professionals. To ensure a smooth and engaging user experience, it's crucial to efficiently display these services without overwhelming the user with a single, massive load. This problem focuses on implementing an "infinite scroll" pattern, allowing users to seamlessly discover more services as they scroll down the page, mimicking a real-world product interaction.
Your primary task is to build a React component that displays a list of service items and implements an infinite scrolling mechanism to load more data.
div showing its id and name.Constraints
fetchServices function that simulates an asynchronous API call, returning a paginated list of service items after a delay. This function will return an empty array when no more items are available.IntersectionObserver for detecting scroll proximity due to its performance benefits and modern API usage, but a simple scroll event listener is also acceptable for this problem's difficulty.services, loading, hasMore, nextPageToFetch) managed effectively and cleanly?Loading editor...