I have to issue in displaying the image in react. List of all Image urls in get from firebase storage.Passing all the urls display the image shows urls.map is not a function
const ViewImages = () => {
var storageRef = firebase.storage().ref("images/");
const [image, setImage] = useState(""); const [urls, setFiles] = useState("");
const [imageUrl, setImageUrl] = useState([]);
useEffect(() => { const fetchImages = async () => {
let result = await storageRef.child('images1/').listAll();
let urlPromises = result.items.map(imageRef => imageRef.getDownloadURL());
return Promise.all(urlPromises);
//console.log(urlPromises);
}
const loadImages = async () => {
const urls = await fetchImages();
setFiles(urls);
console.log(urls[0]);
}
loadImages();
}, []);
return(
{urls.map((urls,i) => (
<img src={urls} key={i}/>
))}
</div>
);
}
export default ViewImages;