I have the following embed code from infogram which is not rendering on my react app.
code looks as below:
<div class="infogram-embed" data-id="861ca70e-552c-4a4f-960a-4c7e7ff62881" data-type="interactive" data-title="Step by Step Charts"></div><script>!function(e,t,s,i){var n="InfogramEmbeds",o=e.getElementsByTagName("script")[0],d=/^http:/.test(e.location)?"http:":"https:";if(/^\/{2}/.test(i)&&(i=d+i),window[n]&&window[n].initialized)window[n].process&&window[n].process();else if(!e.getElementById(s)){var r=e.createElement("script");r.async=1,r.id=s,r.src=i,o.parentNode.insertBefore(r,o)}}(document,0,"infogram-async","https://e.infogram.com/js/dist/embed-loader-min.js");</script><div style="padding:8px 0;font-family:Arial!important;font-size:13px!important;line-height:15px!important;text-align:center;border-top:1px solid #dadada;margin:0 30px"><a href="https://infogram.com/861ca70e-552c-4a4f-960a-4c7e7ff62881" style="color:#989898!important;text-decoration:none!important;" target="_blank">Step by Step Charts</a><br><a href="https://infogram.com" style="color:#989898!important;text-decoration:none!important;" target="_blank" rel="nofollow">Infogram</a></div>
I am using a html parsing library for react which works perfectly fine in all other cases.
Any idea why this is not working?
Thanks
Not sure if this helps, here is how I made it work with React https://jsfiddle.net/wonderwhy_er/4dt28xzL/6/
Or code In HTML
<script>!function(e,t,s,i){var n='InfogramEmbeds',o=e.getElementsByTagName('script')[0],d=/^http:/.test(e.location)?'http:':'https:';if(/^\/{2}/.test(i)&&(i=d+i),window[n]&&window[n].initialized)window[n].process&&window[n].process();else if(!e.getElementById(s)){var r=e.createElement('script');r.async=1,r.id=s,r.src=i,o.parentNode.insertBefore(r,o)}}(document,0,"infogram-async","https://e.infogram.com/js/dist/embed-loader-min.js");</script>
<div id="app"></div>
In JS
class App extends React.Component {
constructor(props) {
super(props)
}
render() {
return (
<div>
<div class="infogram-embed" data-id="861ca70e-552c-4a4f-960a-4c7e7ff62881" data-type="interactive" data-title="Step by Step Charts">
</div>
</div>
)
}
}
ReactDOM.render(<App />, document.querySelector("#app"))
I moved script part away, it just requests a loader from Infogram and you do not need to do it inside of React render, so I just moved it to header of page or something.
You also have something else at the end of the embed which I remeved and it works. Check link.