Hack Frontend Community

Infinite Scroll with API

Hard

Implement infinite scroll with API data loading. Requirements: ✓ Load next items when scrolling to bottom ✓ Loading indicator during fetch ✓ Error handling with retry option ✓ Prevent multiple requests (debounce/throttle) ✓ Display "No more items" when all data is loaded ✓ Smooth scroll experience without bugs ✓ Performance optimization API endpoint (mock): - Use built-in fetchUsers(page, limit) function - Returns { data: User[], hasMore: boolean } - Simulates 500ms network delay Acceptance Criteria: ✓ First page loads on mount ✓ Next page loads automatically when reaching bottom ✓ Loading state displays correctly ✓ No duplicate requests ✓ Edge cases handled (empty list, errors, last page) ✓ Performance optimized (useCallback, useMemo where needed)