meteor-google-maps icon indicating copy to clipboard operation
meteor-google-maps copied to clipboard

How to use with react?

Open hafeez1042 opened this issue 10 years ago • 15 comments

I am using react as front end, is it possible to use with reactJS

hafeez1042 avatar Nov 26 '15 03:11 hafeez1042

Yes! https://github.com/dburles/meteor-google-maps#examples https://github.com/dburles/meteor-google-maps-react-example

dburles avatar Nov 26 '15 03:11 dburles

Did that help @hafeez1042 ?

dburles avatar Dec 01 '15 00:12 dburles

thank you @dburles , Actually i didn't check that, i was busy with some other project. i will inform you after checking.

hafeez1042 avatar Dec 02 '15 01:12 hafeez1042

I'm getting 'Uncaught InvalidValueError: GoogleMaps.initialize is not a function' on meteor 1.3, has anyone tried this with the new beta? tks!

fpaboim avatar Jan 08 '16 19:01 fpaboim

@fpaboim got pretty much the same error Uncaught TypeError: _dburlesGoogleMaps2.default.load is not a function

peterpetre avatar Apr 27 '16 12:04 peterpetre

Hey guys I can't reproduce any errors on 1.3 are you able to reproduce the error on a fresh application so I can take a look?

dburles avatar Apr 27 '16 13:04 dburles

https://github.com/peterpetre/meteor-test-google-maps

peterpetre avatar Apr 27 '16 15:04 peterpetre

You don't (yet) need to import GoogleMaps as it's global. I'm yet to update the package to support modules. Hope to do that soon.

dburles avatar Apr 27 '16 22:04 dburles

Are there any more complex examples of this working in react? I'm trying to use it with flowrouter but not having much luck.(Meteor 1.3)

eljefejames avatar Jun 15 '16 11:06 eljefejames

Hey, I think you can not use this package directly with react, because you need to use a Blaze template.

You can do it with both React Blaze components, check the Meteor guide. Like for example you can do something like this

hope it helped you.

2016-06-15 13:14 GMT+02:00 eljefejames [email protected]:

Are there any more complex examples of this working in react? I'm trying to use it with flowrouter but not having much luck.(Meteor 1.3)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dburles/meteor-google-maps/issues/95#issuecomment-226158032, or mute the thread https://github.com/notifications/unsubscribe/ALm7LjGZDF7ubQQ-IDdKos81EYySRPy8ks5qL96sgaJpZM4Gpsik .

lcrpt avatar Jun 20 '16 08:06 lcrpt

You don't have to use the blaze template. With React you can use the create method https://github.com/dburles/meteor-google-maps#create

dburles avatar Jun 20 '16 08:06 dburles

do you have samples using react updating/adding new markers after render?

wiredots01 avatar Jan 16 '17 07:01 wiredots01

@wiredots01 not specifically, however start with this example and you would place the logic here: https://github.com/dburles/meteor-google-maps-react-example/blob/master/imports/MyMap.js#L13-L16

To make it reactive, place a Tracker.autorun or use a cursor observe method inside of the GoogleMaps.ready. See here https://github.com/dburles/reactive-maps-example/blob/master/reactive-maps-example.js#L5-L37

dburles avatar Jan 16 '17 10:01 dburles

ive tried fetching the data from external API when the button was clicked... but it didnt work when updating

wiredots01 avatar Jan 16 '17 13:01 wiredots01

@wiredots01 going to need a little bit more info than that my friend!

dburles avatar Jan 17 '17 23:01 dburles