Input
`fetchPage(3)` resolves with `[]`
Output
No further fetches are made even if the user keeps scrolling
Build an infinite scroll feed in React. You are given `fetchPage(page: number): Promise<{ id: number; title: string }[]>`. Fetch page 1 on mount and render each item as `data-testid="feed-item"`. Wrap the feed in `data-...
App.tsxEditable starter`fetchPage(3)` resolves with `[]`
No further fetches are made even if the user keeps scrolling
How would you handle the case where `fetchPage` rejects? Add an error state with a retry button that re-fetches the failed page without losing the items already loaded.