const imageCache = new Map();
export const useImages = (...paths: string[]) => {
const images = paths.map((path) => {
if (imageCache.has(path)) {
return imageCache.get(path)!;
}
const img = document.createElement("img");
img.src = path;
imageCache.set(path, img);
return img;
});
return images;
};