MQ with react leaflet

5 posts / 0 new
Last post
Amir Cicak
MQ with react leaflet

Hi,

I am trying to use react leaflet with MapQuest. Since MapQuest still doesn't have React support I use <script> tags in index.html to include both leaflet and MQ libs. Later on I can create MQ Layer calling:
window.MQ.mapLayer()
That one should be passed to my React Leaflet map instead of specifying TileLayer markup with url/attribution params. Problem is that attribution is dynamic in MQ and I cannot just hard code it and also I get different map layers if I just use single URL instead of using the layer object (which i test in non react code).
Also I suppose that MQ Layer is instantiated with different L instance (the global one coming from script tag) instead of imported L instance local to my class (and I guess the one in react context) so even if I somehow passed that object to the React Leaflet I am not sure if it would work.

Is there a way to import MQ using ES6 modules so I can import it after L and it uses the same instance? I asked similar question on React Leaflet forum too so I hope they will help with passing the Layer object instead of using TileLayer markup (meantioned it here in case someone happens to know that too).

Thanks


MQBrianCoakley
MapQuest.js is not compatible
MapQuest.js is not compatible with React Leaflet. It was never intended to be. There is no plan to support it at this time.

Amir Cicak
Thank you for a quick reply.

Thank you for a quick reply.


selvaraj
MapQuest with react integration

Hi 

Am trying to integrate mapquest on react js, but 'L' is not defined . let me know , how to solve this problem..

 


MQBrianCoakley
I don't do react so I'm not
I don't do react so I'm not sure I can't help you here. Sorry.