JSFiddle - React, Tailwind, and code Playground
HTML
<div class="result"></div>
CSS
img {
width: 100px;
height: 100px;
padding: 0 5px;
}
JavaScript
const options = {
method: 'GET',
mode: 'cors'
};
fetch(`https://picsum.photos/v2/list?page=1&limit=10`, options)
.then((response) => response.json())
.then((data) => {
let imgAll = data.map(item => `<img src="${item.download_url}" alt>`)
document.querySelector('.result').insertAdjacentHTML('beforeend', imgAll.join(''))
})
.catch(() => {
console.log('error')
});