每当我导入此 @react-google-maps 库时,我都会收到此错误。谁能帮我解决这个问题?
这是我的组件-
const {withScriptjs, withGoogleMap, GoogleMap, Marker} = require('react-google-maps');
const VenueMap = React.createClass({
getInitialState() {
const {eventData} = this.props;
const stateObj = {
position: {
lat: eventData.venue.latitude,
lng: eventData.venue.longitude,
},
defaultZoom: 17
};
return stateObj;
},
render: function () {
const {state} = this;
const MapComponent = compose(
withProps({
googleMapURL: GOOGLE_MAP.mapURL,
loadingElement: <div style={{height: `100%`}}/>,
containerElement: <div style={{height: `300px`, marginBottom: `30px`}}/>,
mapElement: <div style={{height: `100%`}}/>
}),
withScriptjs, withGoogleMap
)(props => (
<GoogleMap
defaultZoom={state.defaultZoom}
defaultCenter={state.position}>
{props.isMarkerShown && <Marker position={state.position}/>}
</GoogleMap>
));
return (
<div id="venuelocation" className="contents-wrapper">
<div className="orgname" style={{paddingBottom: '20px'}}>Venue Location</div>
<MapComponent isMarkerShown={true}/>
</div>
);
}
});
我正在使用 react 16.3.2 reactjs 版本。