Where to Pass API Key?
Before I begin, please forgive me as I'm relatively new, but...
Where does one pass the API key when using this repository? I've poured over all of the the documentation both here and on Full Stack React and see nothing regarding where to actually pass one's Google Maps API Key.
So far, the only conclusion I've come to is on line 32 of GoogleApi.js in the node modules folder where the default argument of opts.hasOwnProperty() is 'apikey'.
If anyone could tell me if I'm close or totally wrong and why I'd be most grateful. Thanks!
I would like to knonw this as well. It seems that it is somehow passed in through the this.props.google item, but I am not sure what that is, or how to use it...
There is a file in the root of the project called '.env.example'. Place your key in this file and rename to '.env'. (I have single quotes around my key but I'm not sure if that necessary.)
If you're still having trouble, check out the stand alone project in the 'GettingStarted' folder here: 'https://github.com/tzerb/google-maps-react'
It's on README: https://github.com/fullstackreact/google-maps-react#automatically-lazy-loading-google-api
Automatically Lazy-loading Google API
The library includes a helper to wrap around the Google maps API. The
GoogleApiWrapperHigher-Order component accepts a configuration object which must include anapiKey. See lib/GoogleApi.js for all >options it accepts.import {GoogleApiWrapper} from 'GoogleMapsReactComponent' // ... export class Container extends React.Component {} export default GoogleApiWrapper({ apiKey: __GAPI_KEY__ })(Container)The
GoogleApiWrapperautomatically passes theManually loading the Google API
If you prefer not to use the automatic loading option, you can also pass the
window.googleinstance as apropto your<Map />component.
Look at here