The question at hand deals with Google Ad Sense specifically but could apply to any script tag insert. I don\'t understand how I could add something like this to my compon
Maybe you can use this react-component: react-adsence. It supports both Google and Baidu.
Google AdSence gives you the ad code below:
So how to include it in a react component? Very easy:
style, client, slot, format.(adsbygoogle = window.adsbygoogle || []).push({}); in the componentDidMount lifecycle method.Then get the react-adsence. How to use it?
import AdSence from 'react-adsence';
Before doing this, you should add the script in the HTML.
Notice: modify the client/slot with yours.