Closed melkati closed 7 years ago
I've just updated the GoogleMap component to fix a bug whereby the map would fail to re-render once unmounted/remounted https://github.com/dburles/meteor-google-maps-react-example. Also I've added some reactivity, click the map to add markers and they're inserted into a collection.
Also pass the key
into GoogleMaps.load
Hi.
I'm sorry if it's a very long message with many questions (and probably some of them very basic) but I'm just starting with Meteor and React.
I have some issues while using the package with react. I'll try to document and include enough code and information so, hopefully, when issues are fixed, it serves as an example also for others trying to use it with react as I see these questions are very frequent but can't find a clear answer, after searching the net for days.
I have Mongo collection where I store GPS positions sent from my mobile via MQTT with OwnTracks http://owntracks.org/booklet/features/android/
I managed to show the positions in a Google Map but I'm unable to make it reactive (I created a container with react-composer where the collection is passed to the Google Map component each time there is a new document).
I know I have some duplicate code as I based it on the react example don't I don't totally understand how it works. Also I left a lot of code I used to debug, but I think it makes clear the intent at each part of the code.
The issues I have are:
Now to the code:
This is the main page, where everything is loaded:
\imports\ui\pages\Maps.js
This is the container where new data is loaded into the collection each time there is a new document. I tested it and it works.
\imports\ui\containers\NoderedMap.js
Now to the presentational component... it's in two files as it's based on the example and I don't understand If I should get rid of the createContainer. I already tried to remove it, but then everything stops working:
\imports\ui\components\NoderedMap.js
Second component: \imports\ui\components\googlemaps\GoogleMap.js
One last issue:
I tried including the Google Maps Api Key in the handleMapOptions() but I still can see in the console the message "Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys".