0.0.5 • Published 7 years ago

react-google-adsense v0.0.5

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

react-google-adsense

A simple ReactJS component for displaying Google AdSense adverts. The component's render() method returns the <ins> element containing the advert, and the componentWillMount() method handles injecting and loading the Google Adsense SDK.

Usage

npm install --save react-google-adsense to install the module locally.

improt React, { Component } from 'react';
import ReactGoogleAdsense from 'react-google-adsense';

export default class MyComponent extends Component {
    render() {
        const adSenseClientId = 'abcdef';
        const adSenseSlotId = 'ghijkl';
        return (
            <ReactGoogleAdsense
                client={adSenseClientId}
                slot={adSenseSlotId}
            >
        );
    }
}

Other (optional) props that can be passed to the component are:

  • format: ad format. Defaults to auto.
  • className: css class to apply to the DOM element.
  • style: an object containing CSS styles to apply to the DOM element. Defaults to { display: block }.