google is not defined in react app using create-react-app

前端 未结 4 1659
攒了一身酷
攒了一身酷 2020-12-08 14:51

I create a react app using the cli called create-react-app. Look like Facebook did lots of things underneath, such as webpack etc. However, I guess it may also has some limi

4条回答
  •  既然无缘
    2020-12-08 15:11

    Hi you can use withGoogleMap like so:

    import { withGoogleMap, GoogleMap, Marker, InfoWindow } from "react-google-maps";
    
    const google = window.google;
    
    class MapComponent extends Component {
    ....
    
    
    .....
    .....
    .....
    
    
    export default withGoogleMap(MapComponent);
    

提交回复
热议问题