Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Installed
react@^19.2.0
react-dom@^19.2.0

Capture Product Visible on Viewport When User Stops Scrolling

Prompt

Track which product cards are visible in the viewport after the user stops scrolling. When scrolling stops (debounced) use IntersectionObserver to collect all currently visible product elements and log or display them. Useful for analytics impression tracking.

Debounce the scroll event (300ms). When scroll stops loop through product refs and check if each intersects viewport using getBoundingClientRect() or IntersectionObserver. Maintain a visibleProducts set in state.
Test Results

Capture Product Visible on Viewport When User Stops Scrolling

Track which product cards are visible in the viewport after the user stops scrolling. When scrolling stops (debounced) use IntersectionObserver to collect all currently visible product elements and log or display them. Useful for analytics impression tracking.