我试图使用google-map-react
,但是当我尝试呈现它,似乎什么都没有。我错过了什么吗?谷歌地图发生反应,出现
import GoogleMap from 'google-map-react';
import React, { Component } from 'react';
class GMaps extends Component {
static defaultProps = {
center: {lat: 59.95, lng: 30.33},
zoom: 11
};
render() {
return (
<div>
<GoogleMap
style={{width: "100%", height: "500"}}
defaultCenter={this.props.center}
defaultZoom={this.props.zoom}
/>
</div>
)
}
}
行之有效这里https://jsbin.com/xoqogolake/1/edit?js,console,output。你有任何错误。你是如何渲染它 –
我没有得到任何错误。 – joethemow
是的这有效,任何想法如何获得用户当前位置? – joethemow