Mapping and Setting State

My Code snippet says it all I have a state variable, that I’m trying to set with img URLs from Firebase but it doesn’t keep the array of them, it only keeps one. I’m using firebase storage to store images. And I get the urls, but I can’t seem to set it to the State Variable, I’ve also tried many other methods but nothing seems to work right.

const [ imgs, setImgs ] = useState([]);
imagesRef.listAll().then(res => {
      let imgArray = [];
      res.items.forEach(itemRef => {
        itemRef.getDownloadURL().then(url => setImgs([...imgs, url]))
      })
    }).catch(function(error) {
      console.log('error: ', error);
    })

you should set the state once after the loop is completed… also you might want to try Promise.all??