I have implemented the use of fullstackreact/google-maps-react
npm install --save google-maps-react
To begin, create a component for Google Maps.
import React, {PropTypes} from 'react';
import Map, {GoogleApiWrapper, Marker} from 'google-maps-react';
export class Container extends React.Component {
render() {
if (!this.props.loaded) {
return <div>Loading...</div>
}
return (
<Map google={this.props.google}
zoom={12}
initialCenter={{lat: this.props.lat, lng: this.props.lng}}
style={{width: '100%', height: '100%', position: 'relative'}}>
</Map>
)
}
}
export default GoogleApiWrapper({
apiKey: <YOUR_KEY_HERE>
})(Container)
Once you have created the Container.jsx file above, import it as a component and use it like so:
import Container from './Container.jsx';
...
<Container lat={YOUR_LAT} lng={YOUR_LNG} />
This serves as a basic guide on utilizing the library, with the option to add markers, labels, and more features. For further instructions, please refer to How to Write a Google Maps React Component