我正在尝试将Instagram嵌入到我的react应用程序中,但是由于某些原因,图像无法渲染。
答案 0 :(得分:0)
这解决了这个问题:
this.setState({
mainImage: data.mainImage,
uuid: data.uuid,
title: data.title,
author: data.author,
tags: data.tags,
premium: data.premium,
preamble: data.preamble,
body: data.body,
publishingTime: data.publishingTime,
},() =>{
const instagramScript = document.createElement("script");
instagramScript.src = "//www.instagram.com/embed.js";
instagramScript.async = true;
document.body.appendChild(instagramScript);
const twitterScript = document.createElement("script");
twitterScript.src = "https://platform.twitter.com/widgets.js";
twitterScript.charset = "utf-8";
twitterScript.async = true;
document.body.appendChild(twitterScript);
});