i am having a problem with a facebook chat component, i am initing it within componentDidMount and it will load the component if you do a hard refresh on /contact but wont render the chat component if we browse to /home or /about and then back to the contact page.
code for component :
componentDidMount() {
window.fbAsyncInit = function() {
FB.init({
appId : 'my-app-id',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.11'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
render() {
return (
<div
className='fb-page'
data-href='https://www.facebook.com/mypage/'
data-tabs='messages'
data-width='450'
data-height='280'
data-small-header='true'>
<div className='fb-xfbml-parse-ignore'>
<blockquote />
</div>
</div>
and here if what i mean, if you hard refresh the page you get what i want with this: https://ibb.co/gECpXm.
but if i browse to /home and then back i get this: https://ibb.co/bLDwCm
I am using React 16 and React router 4 for the routing.
Thanks in Advance