1
我有一个组件需要根据应用程序的状态加载更改Pinterest嵌入。 Pinterest嵌入由一个<a>
标签组成,通过使用我的HTML底部的异步脚本(可用here)将其转换为<span>
标签内的复杂布局。但是,我很难弄清楚如何通过使用更新后的道具进行重新渲染来清除嵌入的旧<span>
并重新运行脚本以呈现新的嵌入。谢谢!正在更新Pinterest嵌入Preact App
我的组件:
const PinterestEmbed = ({ location, size }) => (
<div stye="text-align: center;margin: auto;">
<a
data-pin-do="embedPin"
data-pin-width={size}
href={location}>
Pin via Pinterest
</a>
</div>
);
export default PinterestEmbed;