I'm trying to pull photos from a facebook page and place them on a my gatsby website, but I'm having trouble integrating Facebook SDK so I can use Graph API to grab the data I need. I've tried just getting the url of the photos and used them in img tags, but the photos disappear as I refresh the page.
I used axios to get the data
getFacebookAPI = () => {
let imgArray = []
axios.get('https://graph.facebook.com/v2.7/me?fields=id,albums{photos{images}}&access_token=exampletoken')
.then(response => {
console.log(response)
console.log(response.data.albums.data[0].photos.data)
response.data.albums.data[0].photos.data.map(info =>
imgArray.push(info.images[0].source)
)
})
return imgArray.map(info => <img src={info} alt="facebook" />)
}