#How to add images recursively without framework?

5 messages · Page 1 of 1 (latest)

lusty path
#
---
export interface Props {
    images?: string[]; // Accept an array of image URLs
}

const { images } = Astro.props;

const renderImages = (imageUrls: string[]) => {
    return imageUrls.map(imgUrl => (
        <li>
            <img src={imgUrl} />
        </li>
    ));
};
---

<section>
    <ul>
        {renderImages(images)}
    </ul>
</section>
remote leaf
#
---
export interface Props {
    images?: string[]; // Accept an array of image URLs
}

const { images } = Astro.props;
---
<section>
    <ul>
        {images.map(url=> <li><img src={url}></li>)}
    </ul>
</section>
lusty path
#

Thank you very much for Correct Solution 🆗