const [photo, setPhoto] = React.useState([]);
const addPhoto = async (e) => {
await setPhoto(e.target.files);
};
const returnPhoto = () => {
if (photo.length > 0) {
for (let i = 0; i < photo.length; i++) {
return(
<div style={{background: '#303030', display: 'inline-flex'}}>
<img alt='pic' style={{maxHeight: '10em', maxWidth: '10em'}} src={URL.createObjectURL(photo[i])}/>
</div>
)}}}
Does anyone see what I did wrong? I'm trying to return a useState's current selected files... I assume I should alter the addPhoto() function but so far I don't know how.