react-google-maps
react-google-maps copied to clipboard
GoogleMapHolder.js:53 Uncaught TypeError: Cannot read property 'object' of undefined
i use this code.
mport React, { Component } from 'react';
import PropTypes from 'prop-types';
import { GoogleMapLoader, GoogleMap } from 'react-google-maps';
class MapGoogle extends Component {
constructor(props){
super(props);
console.log("lon" + this.props)
}
render(){
return(
<GoogleMapLoader containerElement={<div style={{height:'100%'}}></div>}
googleMapElement={
<GoogleMap defaultZoom={12}
defaultCenter={{lat: -25.363882, lng: 131.044922}}/>
}
/>
);
}
}
MapGoogle.propTypes = {
lat: PropTypes.number,
lng: PropTypes.number
}
export default (MapGoogle);
when i run project, i have to error:
GoogleMapHolder.js:53 Uncaught TypeError: Cannot read property 'object' of undefined
I have run into a similar issue – it raises when defining the prop types. For example, in GoogleMaps.js:
var controlledPropTypes = {
center: _react.PropTypes.object, // boom, _react.PropTypes is undefined
This is on React v16.0.0, where prop-types has been extracted to a separate library, so I assume that's why it's failing.
@ttson24 Turns out I was running an old version (v6.0.3) of react-google-maps. Make sure you update to the latest version (v9.4.5 currently)
Thank you @schrockwell . That worked for me