Skip to content

Instantly share code, notes, and snippets.

@loraxx753
Created July 9, 2018 01:13
Show Gist options
  • Save loraxx753/5fc5864d043b702def7c4150477bd742 to your computer and use it in GitHub Desktop.
Save loraxx753/5fc5864d043b702def7c4150477bd742 to your computer and use it in GitHub Desktop.
import React, { Component } from "react";
import firebase from "../firebase.js";
const imageRef = muhImage => {
firebase
.storage()
.ref()
.child("images/" + muhImage)
.getDownloadURL()
.then(function(url) {
console.log(url);
return url;
})
.catch(function(error) {
// Handle any errors here
});
};
const Image = ({ image }) => {
return (
<li>
<img
src={imageRef(image.fileName)}
href={imageRef(image.fileName)}
alt="image"
/>
<div>{image.imageID}</div>
<div>{image.imageDate}</div>
</li>
);
};
export default Image;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment