I am beginner in reactjs and I want to embed google inline ads in loops. The ad is showing only at first time. When I inspect the element tag shows in loop. Can I please kno
npm install --save react-adsense
import React from 'react';
import AdSense from 'react-adsense';
export default class AdsenseWidget extends React.Component {
componentDidMount() {
const installGoogleAds = () => {
const elem = document.createElement("script");
elem.src =
"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
elem.async = true;
elem.defer = true;
document.body.insertBefore(elem, document.body.firstChild);
};
installGoogleAds();
}
render () {
return (
);
}
}