This is mainly a question about 'translating' JS to JSX.
I have a react-google-maps map which contains a marker, and a circle around that marker:
The Map component:
export class Map extends Component {
render() {
const GoogleMapInstance = withGoogleMap(props => (
<GoogleMap
defaultCenter = { { lat: parseFloat(this.props.lat), lng: parseFloat(this.props.lng) } }
defaultZoom = { 16 }
defaultOptions={{ styles: mapStyles }}
>
<Marker position={{ lat: parseFloat(this.props.lat), lng: parseFloat(this.props.lng) }}/>
<Circle center={{ lat: parseFloat(this.props.lat), lng: parseFloat(this.props.lng) }} radius={parseFloat(this.props.accuracy)} options={{ fillColor: 'red', strokeColor: 'red' }}/>
</GoogleMap>
))
return (
<div>
<GoogleMapInstance
containerElement={ <div style={{ height: '600px', width: '100%' }}/> }
mapElement={ <div style={{ height: '100%' }}/> }
/>
</div>
)
}
}
I would like the map to be zoomed such that the circle takes up about 50% of the map. I understand using the Javascript API, I can just do:
map.fitBounds(circle.getBounds())
But I'm not sure how to integrate that with the JSX that I have...