Frontend School

Virtualized Transaction List

Machine Coding
medium

Virtualized Transaction List

Medium
Virtualization
Performance
React
Frontend

Overview

Intuit products, like QuickBooks and TurboTax, frequently handle large datasets such as financial transactions, invoices, or customer lists. Displaying these extensive lists efficiently without performance degradation is paramount for a smooth user experience. This problem challenges you to build a performant virtualized list component for financial transactions, ensuring a responsive UI even when dealing with thousands of items.

What you need to do / Task

Your primary task is to implement a VirtualizedList component that efficiently displays a large collection of financial transactions.

  1. Implement Virtualization: The VirtualizedList component must only render the items currently visible within its viewport, plus a small buffer of items above and below, to minimize DOM elements.
  2. Display Transaction Data: Each transaction item in the list should clearly display its id, description, amount, and date.
  3. Item Selection: Implement a basic selection mechanism. Clicking a transaction item should toggle its selected state (highlighted visually).
  4. Performance: Ensure the list scrolls smoothly without jank, even when populated with a very large number of items (e.g., 10,000+).

UI/UX expectations

  • The list should be contained within a fixed-height scrollable container.
  • Each transaction row must have a consistent, fixed height (e.g., 60px).
  • Selected items should have a distinct background color or other visual indicator.
  • The overall layout should be clean and readable, using the provided basic styles.

Acceptance criteria

  • The VirtualizedList component correctly renders the provided mock data.
  • Scrolling performance is smooth and free of noticeable lag, even with thousands of items.
  • Only a limited number of items (visible + buffer) are present in the DOM at any given time, verifiable via browser developer tools.
  • Clicking on a transaction item correctly toggles its selection state, and the visual feedback updates instantly.
  • The list maintains its scroll position reliably when items are selected/deselected or other state changes occur (no unexpected scroll jumps).

Constraints

Constraints & assumptions

  • Assume all list items have a fixed, consistent height (e.g., 60px), which will be provided as a prop.
  • The total number of items to display can be very large (e.g., 10,000+).
  • The list container will have a fixed height (e.g., 500px), also provided as a prop.
  • You are free to use React hooks (useState, useEffect, useRef, useCallback, useMemo) as needed.
  • Focus on the core virtualization logic and performance; complex styling beyond the provided skeleton is secondary.

Out of scope

  • Handling dynamic or variable item heights.
  • Implementing infinite scrolling (loading more data on scroll).
  • Advanced accessibility features beyond basic click interaction.
  • Backend integration or data fetching.

What interviewers evaluate

  • Correctness of Virtualization: The ability to correctly implement the core virtualization logic, ensuring only necessary items are rendered.
  • Performance Optimization: Demonstrating an understanding of how to achieve smooth scrolling and manage DOM elements efficiently.
  • React Best Practices: Using React hooks and patterns effectively for state management and component lifecycle.
  • Code Quality: Writing clean, modular, and readable code that is well-structured and maintainable.

Loading editor...