# 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`.
    - See [this page](https://support.google.com/adsense/answer/185665?visit_id=1-636422722735653897-2461086025&ref_topic=29561&rd=1) for further info on formats.
- 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 }`.