getMapContext() - how does it work ? #253
-
| Hi, I'm trying to access the  I've tried with but got the error TypeError: Cannot read properties of undefined (reading 'map') Is the getMapContext() exposed outside of the MapLibre component ? Thanks in advance for your feedback. | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
| It's just a wrapper around  This also came up in #247 which has some ideas on how you could try making this work, but as of right now it would require a small fork/patch to the package. | 
Beta Was this translation helpful? Give feedback.
-
| Thank you! So as long as all my components "live" under the MapLibre component, I will have access to the getMapContext (which I confirm is working). The workaround is to createMapContext at the top level of my App, with the potential side effects as described under #247 | 
Beta Was this translation helpful? Give feedback.
It's just a wrapper around
getContext, so the context only exists inside the MapLibre component which sets it.This also came up in #247 which has some ideas on how you could try making this work, but as of right now it would require a small fork/patch to the package.