Hook for loading image URLs based on viewport visibility
Optimizes network usage by only fetching image URLs for recipes that are visible or about to become visible in the viewport. Includes debouncing, cancellation, and concurrency limiting.
Configuration options for the loader
Object containing the imageMap and pending count
const { imageMap, pendingCount } = useVisibleImageLoader({ recipes: discoveredRecipes, visibleUrls: currentlyVisibleUrls, fetchImageUrl: (url, signal) => provider.fetchImageUrlForRecipe(url, signal),}); Copy
const { imageMap, pendingCount } = useVisibleImageLoader({ recipes: discoveredRecipes, visibleUrls: currentlyVisibleUrls, fetchImageUrl: (url, signal) => provider.fetchImageUrlForRecipe(url, signal),});
Hook for loading image URLs based on viewport visibility
Optimizes network usage by only fetching image URLs for recipes that are visible or about to become visible in the viewport. Includes debouncing, cancellation, and concurrency limiting.