I'm super new to the world of Javascript and React. I'm currently building an app using the Ionic framework. It's using an existing firebase Project.
Im trying to fetch avatar images from firebase storage, using this function in my react component:
async function getAvatarRef(avatarId: string): Promise<String> {
const avatarUrl = await avatarsRef.child(avatarId).getDownloadURL();
return avatarUrl.toString();
}
then I'm calling that function to get the download URL using the UserID that I'm grabbing from Firebase Auth here:
<IonImg src={getAvatarRef(child.avatarId)} />
My issue though is that the function is returning a Promise<string>
but the src
property from IonImage
is wanting just a simple String
type
This is the error I'm getting: Type 'Promise<string>' is not assignable to type 'string'.
I've looked all over but can't seem to find a solution.
Anyone here have any ideas?