The API being handed to you sounds like a gift until you realize the hard part was never the data fetching.
Start by clarifying requirements and constraints, then outline a high-level architecture that separates data fetching, caching, and UI rendering. Focus on how you would implement infinite loading with pagination, offline support using service workers and local storage, and testing strategies including unit, integration, and E2E tests. Emphasize trade-offs and justify your choices.
Pro tip: Demonstrate awareness of performance metrics (e.g., Time to Interactive, First Contentful Paint) and how your design impacts them. Also, mention how you would handle edge cases like network flakiness and cache invalidation.
Ask questions to understand the API (e.g., pagination style, rate limits), expected scale, browser support, and offline expectations. Confirm that no likes/comments simplifies the data model.
Choose a pagination strategy (cursor-based preferred) and implement infinite scroll using Intersection Observer. Discuss state management for loading, error, and end-of-list states.
Use a service worker to cache API responses and static assets. Store fetched images and metadata in IndexedDB or Cache API for offline access. Handle synchronization when back online.
Write unit tests for data fetching and state logic, integration tests for component interactions, and E2E tests for infinite scroll and offline scenarios. Mock API responses and simulate network conditions.
Compare libraries vs. custom solutions, caching strategies (stale-while-revalidate), and performance optimizations (lazy loading, image compression). Mention accessibility and error handling.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.