Returning an image from Firebase storage within Reactjs
I have a function which goes off to retrieve an image from Firebase Storage:
I have a function which goes off to retrieve an image from Firebase Storage:
I’m trying to create a custom hook that will load the URL for an image stored in Firebase.
I’m newbie of Firebase, specially Firebase-storage. I’m trying follow [Firebase-storage upload files docs][1].
So i’m trying to send image files uploaded by my users to firebase storage using the file type input element. Like this:
I bet it’s something very trivial, but even the docs arent clear about this. I don’t have to mention that writing anything about firebase in google search returns topics that are related not with JS/WEB but with android in most cases…
My product uses firebase rtdb, firestore, storage, auth, and hosting.
I didn’t make any changes to my CORS configuration. However, today I started getting the following CORS error while trying to upload images to storage, and retrieve them:
I’m trying to map array to get image url from Firebase storage and list them to page. The code give me a url, but the problem is that code not set url to img
variable on time and returning empty img
variable.
i’m trying to do something in react and i got stuck .. i don’t know why this is happening, i can’t explain myself.
I am trying to display images from Firebase storage in my React app.
I could get all images from Firebase Storage using by listall.
but I don’t know how to display these on ui.
I tried to use map method but didn’t work.
Also, I want to keep these display even if page is reload.
should I use localstrage or useEffect?
I’m using the following code to upload one or multiple files to Firebase Storage. When the upload is completed the downloadURL is logged in the console.