skip to Main Content

Firebase – How to run a function first before updating the array in react JS?

const handleItinerary = (e, type) => { var index = parseInt(e.target.name); let arr = [...itinerary]; if (type === "imageUrl") { const date = new Date().getTime(); const storageRef = ref(storage, `${date}`); uploadBytes(storageRef, e.target.files[0]).then((snapshot) => { getDownloadURL(storageRef).then((downloadURL) => { arr[index]["imageUrl"] = downloadURL;…

VIEW QUESTION
Back To Top
Search