import { use, useState } from 'react'; import { useEffect } from 'react'; interface GalleryThumbnailProps { id: number; onSelect: (id:number) => void; } const GalleryThumbnail = ({ id, onSelect }: GalleryThumbnailProps) => { const [galleryId, setGalleryId] = useState(id as number); const [thumbnailUrl, setThumbnailUrl] = useState('' as string); const toggleModal = () => { onSelect(galleryId); }; const getData = async () => { const thumbnailResponse = await fetch('/api/galleries/'+galleryId+'/thumbnail'); const thumbnailUrl = await thumbnailResponse.text(); setThumbnailUrl(thumbnailUrl); } useEffect(() => { getData(); }, []); return (