<NME> GoogleApiComponent.js
<BEF> import React from 'react';
import ReactDOM from 'react-dom';

import {ScriptCache} from './lib/ScriptCache';
import GoogleApi from './lib/GoogleApi';

const defaultMapConfig = {};

const serialize = obj => JSON.stringify(obj);
const isSame = (obj1, obj2) => obj1 === obj2 || serialize(obj1) === serialize(obj2);

const defaultCreateCache = options => {
  options = options || {};
  const apiKey = options.apiKey;
  const libraries = options.libraries || ['places'];
  const version = options.version || '3';
  const language = options.language || 'en';
  const url = options.url;
  const client = options.client;
  const region = options.region || null;


  return ScriptCache({
    google: GoogleApi({
      apiKey: apiKey,
      language: language,
      libraries: libraries,
      version: version,
      url: url,
      client: client,
      region: region
    })
  });
};

const DefaultLoadingContainer = props => <div>Loading...</div>;

export const wrapper = (input, className, style) => WrappedComponent => {
  class Wrapper extends React.Component {
    constructor(props, context) {
      super(props, context);

      // Build options from input
      const options = typeof input === 'function' ? input(props) : input;

      // Initialize required Google scripts and other configured options
      this.initialize(options);

      this.state = {
        loaded: false,
        map: null,
        google: null,
        options: options
      };

      this.mapRef=React.createRef();
    }

    componentDidUpdate(props) {
      // Do not update input if it's not dynamic
      if (typeof input !== 'function') {
        return;
      }

      // Get options to compare
      const prevOptions = this.state.options;
      const options = typeof input === 'function' ? input(props) : input;

      // Ignore when options are not changed
      if (isSame(options, prevOptions)) {
        return;
      }

      // Initialize with new options
      this.initialize(options);

      // Save new options in component state,
      // and remove information about previous API handlers
      this.state= {
        options: options,
        loaded: false,
        google: null
      };
    }
    
    componentWillUnmount() {
      if (this.unregisterLoadHandler) {
        this.unregisterLoadHandler();
      }  
    }

    initialize(options) {
      // Avoid race condition: remove previous 'load' listener
      if (this.unregisterLoadHandler) {
        this.unregisterLoadHandler();
        this.unregisterLoadHandler = null;
      }

      // Load cache factory
      const createCache = options.createCache || defaultCreateCache;

      // Build script
      this.scriptCache = createCache(options);
      this.unregisterLoadHandler =
        this.scriptCache.google.onLoad(this.onLoad.bind(this));

      // Store information about loading container
      this.LoadingContainer =
        options.LoadingContainer || DefaultLoadingContainer;
    }

    onLoad(err, tag) {
      this._gapi = window.google;

      this.setState({loaded: true, google: this._gapi});
    }

    render() {
      const {LoadingContainer} = this;
      if (!this.state.loaded) {
        return <LoadingContainer />;
      }

      const props = Object.assign({}, this.props, {
        loaded: this.state.loaded,
        google: window.google
      });

      return (
        <div className={className} style={style}>
          <WrappedComponent {...props} />
          <div ref={this.mapRef} />
        </div>
      );
    }
  }

  return Wrapper;
};

export default wrapper;

<MSG> Update GoogleApiComponent.js
<DFF> @@ -19,7 +19,6 @@ const defaultCreateCache = options => {
   const client = options.client;
   const region = options.region || null;
 
-
   return ScriptCache({
     google: GoogleApi({
       apiKey: apiKey,

{'commit': 'diff --git a/src/GoogleApiComponent.js b/src/GoogleApiComponent.js\nindex 2df467d..69de4f7 100644\n--- a/src/GoogleApiComponent.js\n+++ b/src/GoogleApiComponent.js\n@@ -19,7 +19,6 @@ const defaultCreateCache = options => {\n   const client = options.client;\n   const region = options.region || null;\n \n-\n   return ScriptCache({\n     google: GoogleApi({\n       apiKey: apiKey,\n', 'commit_subject': 'Update GoogleApiComponent.js', 'repo_name': 'fullstackreact/google-maps-react', 'committer': {'name': 'GitHub', 'email': '1505422b2465e9a84f6fdfaa161078890c593f06@github.com', 'time_sec': '1535738691', 'tz_offset': '-360', 'date': {'seconds': '1535738691'}}, 'commit_tree': '816c7d893ed25b20963db4997d20c7dc72cbadf6', 'commit_message': 'Update GoogleApiComponent.js', 'language_name': 'Shell', 'license': 'mit', 'hunks': '@@ -19,7 +19,6 @@ const defaultCreateCache = options => {\n   const client = options.client;\n   const region = options.region || null;\n \n-\n   return ScriptCache({\n     google: GoogleApi({\n       apiKey: apiKey,\n', 'addition_count': 0, 'deletion_count': 1, 'src_file': 'a/src/GoogleApiComponent.js', 'tgt_file': 'b/src/GoogleApiComponent.js', 'file_extension': '.js', 'before_file': "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport {ScriptCache} from './lib/ScriptCache';\nimport GoogleApi from './lib/GoogleApi';\n\nconst defaultMapConfig = {};\n\nconst serialize = obj => JSON.stringify(obj);\nconst isSame = (obj1, obj2) => obj1 === obj2 || serialize(obj1) === serialize(obj2);\n\nconst defaultCreateCache = options => {\n  options = options || {};\n  const apiKey = options.apiKey;\n  const libraries = options.libraries || ['places'];\n  const version = options.version || '3';\n  const language = options.language || 'en';\n  const url = options.url;\n  const client = options.client;\n  const region = options.region || null;\n\n\n  return ScriptCache({\n    google: GoogleApi({\n      apiKey: apiKey,\n      language: language,\n      libraries: libraries,\n      version: version,\n      url: url,\n      client: client,\n      region: region\n    })\n  });\n};\n\nconst DefaultLoadingContainer = props => <div>Loading...</div>;\n\nexport const wrapper = (input, className, style) => WrappedComponent => {\n  class Wrapper extends React.Component {\n    constructor(props, context) {\n      super(props, context);\n\n      // Build options from input\n      const options = typeof input === 'function' ? input(props) : input;\n\n      // Initialize required Google scripts and other configured options\n      this.initialize(options);\n\n      this.state = {\n        loaded: false,\n        map: null,\n        google: null,\n        options: options\n      };\n\n      this.mapRef=React.createRef();\n    }\n\n    componentDidUpdate(props) {\n      // Do not update input if it's not dynamic\n      if (typeof input !== 'function') {\n        return;\n      }\n\n      // Get options to compare\n      const prevOptions = this.state.options;\n      const options = typeof input === 'function' ? input(props) : input;\n\n      // Ignore when options are not changed\n      if (isSame(options, prevOptions)) {\n        return;\n      }\n\n      // Initialize with new options\n      this.initialize(options);\n\n      // Save new options in component state,\n      // and remove information about previous API handlers\n      this.state= {\n        options: options,\n        loaded: false,\n        google: null\n      };\n    }\n    \n    componentWillUnmount() {\n      if (this.unregisterLoadHandler) {\n        this.unregisterLoadHandler();\n      }  \n    }\n\n    initialize(options) {\n      // Avoid race condition: remove previous 'load' listener\n      if (this.unregisterLoadHandler) {\n        this.unregisterLoadHandler();\n        this.unregisterLoadHandler = null;\n      }\n\n      // Load cache factory\n      const createCache = options.createCache || defaultCreateCache;\n\n      // Build script\n      this.scriptCache = createCache(options);\n      this.unregisterLoadHandler =\n        this.scriptCache.google.onLoad(this.onLoad.bind(this));\n\n      // Store information about loading container\n      this.LoadingContainer =\n        options.LoadingContainer || DefaultLoadingContainer;\n    }\n\n    onLoad(err, tag) {\n      this._gapi = window.google;\n\n      this.setState({loaded: true, google: this._gapi});\n    }\n\n    render() {\n      const {LoadingContainer} = this;\n      if (!this.state.loaded) {\n        return <LoadingContainer />;\n      }\n\n      const props = Object.assign({}, this.props, {\n        loaded: this.state.loaded,\n        google: window.google\n      });\n\n      return (\n        <div className={className} style={style}>\n          <WrappedComponent {...props} />\n          <div ref={this.mapRef} />\n        </div>\n      );\n    }\n  }\n\n  return Wrapper;\n};\n\nexport default wrapper;\n", 'message': 'Update GoogleApiComponent.js', 'author_name': 'GitHub', 'lang': 'js'}