El botón funciona pero no muestra la primera foto a menos que se haga clic dos veces. Funciona bien para todas las cargas posteriores... código a continuación:
function addImage(photo) { setAlbum([...album, photo]); } function getImage() { const imageDiv = document.getElementById('images'); const img = document.createElement('img'); img.src = URL.createObjectURL(photo); album.forEach((photo) => { // const img = document.createElement('img'); // document.createElement('img'); imageDiv.appendChild(img); // img.src = URL.createObjectURL(photo); }); } function showImage() { const fileInput = document.getElementById('myFile'); addImage(photo); if(fileInput.files.length === 1) { getImage(); console.log('worked') console.log(photo) // getImage(); // addImage(fileInput.files[0]); } else { console.log('fail') } }