GoogleMap: defaultCenter prop changed. You can't change default props.
See original GitHub issueI used the map component like this:
<GoogleMap
bootstrapURLKeys={{
key:GoogleMapsApiKey,
language:'en'
}}
defaultCenter={{lat:4.352130,lng:50.845926}}
center={{lat: this.state.office.latitude, lng: this.state.office.longitude}}
defaultZoom={9}
zoom={12}
>
</GoogleMap>
So why is it complaining that I changed the defaultCenter
prop?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Child component won't update with new props after setState
The error says exactly what's wrong, you can't change the defaults. Set defaultCenter once, then use your dynamic state variable on center ....
Read more >A Beginner's Guide to google-map-react | by Matt Croak Code
First, you should set up some defaultProps for your map component to use. This is not only useful to implement as your map...
Read more >React Google Maps Style Guide
react-google-maps provides a set of React components wrapping the underlying Google Maps JavaScript API v3 instances. The wrapping simply do: props delegation ...
Read more >google-map-react | Yarn - Package Manager
google-map -react is a component written over a small set of the Google Maps API. It allows you to render any React component...
Read more >google-map-react - npm
It allows you to render any React component on the Google Map. ... export default function SimpleMap(){ const defaultProps = { center: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would suggest to use “center” instead of “defaultCenter”. That works because it doesn’t compare with older center.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.