withScriptjs is undefined
Both of the following still makes withScriptjs undefine:
import { withScriptjs } from 'react-google-maps
import { withScriptjs } from 'react-google-maps/lib/withScriptjs
@thanhacun which version are you using now?
https://github.com/tomchentw/react-google-maps/blob/77a5f4ffead3f818a7a3c86f54dbcbbd852ba912/lib/index.js#L7-L14
I am using version 8.0.0, temporary I have to use
import * as withScriptjs from ...
and use withScriptjs.default as a fucntion
Are u using webpack/babel?
Does this only happen to withScriptjs? Or other components as well?
- I do use webpack/babel (create-react-app)
- It only happens with withScriptjs
Working code sample:
import * as withScriptjs from 'react-google-maps/lib/withScriptjs';
import { withGoogleMap, GoogleMap, Marker } from 'react-google-maps';
const MapWithAMarker = compose(
withScriptjs.default,
withGoogleMap
)(props =>
<GoogleMap
defaultZoom = {8}
defaultCenter = {{ lat: -34.397, lng: 150.644 }}
>
<Marker position={{ lat: -34.397, lng: 150.644 }} />
</GoogleMap>
);
Oh, read the Changlog. WithScriptjs is now exported by root(but I don't know why you can't use it) For explicit import, just use default import:
import withScriptjs from lib/...
Yes as I mention in the first post: if import as the changelog, withScriptjs will be undefined. I have tried both root import and explicit import as well
It is working now! May be when upgrading to v8.0.0, it is not successful!
Very sorry to bother you!
LOL good to hear that!!
Released v8.1.0