react-sgl
Installation
npm install --save react-google-maps # or yarn add react-google-maps
Use & Configuration
const MyMapComponent = ) <MyMapComponent mapsUrl: 'http://path-to-sgl/api/js.js' googleMapsKey: 'googlekey' bbox: '-48.900473,-26.252152,-48.889892,-26.243658'/>
For simplicity, in this documentation, I will use recompose
to simplify the component. It'll look something like this with recompose
:
const MyMapComponent = <SGLMap defaultZoom=8 defaultCenter= lat: -34397 lng: 150644 > <Marker position= lat: -34397 lng: 150644 /> </SGLMap>) <MyMapComponent isMarkerShown />
You can implement your own state transition logic with MyMapComponent
!
const MyMapComponent = <SGLMap defaultZoom=8 defaultCenter= lat: -34397 lng: 150644 > propsisMarkerShown && <SGLMarker position= lat: -34397 lng: 150644 onClick=propsonMarkerClick /> </SGLMap>) PureComponent state = isMarkerShown: false { this } { } { this this } { return <MyMapComponent isMarkerShown=thisstateisMarkerShown onMarkerClick=thishandleMarkerClick /> }