-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get leaflet object of the map inside an extending class #2
Comments
@ptondereau I've looked into the code and the issue mostly stems from the fact that the react-leaflet-universal module exposes a higher-order-component rather than extending the class. As a result, it doesn't have access to the original properties on the class, i.e. it works poorly with inheritance. Unfortunately this is difficult to bypass because "universal inheritance" doesn't really make sense when an instance can only properly exist on the client. I see you've already done some stuff like shifting code to The solution should involving copying the |
@bengoh thank you very much! We use SSR and such feature would be great! |
@ptondereau - first off, apologies for taking so long to get back on this. If you still need assistance on this, there is now support for "render-props" that should help make your situation easier. You won't need to fork
Let me know if this is sufficient for your needs. EDIT: |
@masotime thank you very much! |
how to get leaflet object of the map inside custom class?
Because I'm using https://github.com/YUzhva/react-leaflet-markercluster and I've forked it to use your component but it throws this error:
Uncaught TypeError: Cannot read property '_container' of undefined
.It seems that LayerGroup can't access to the map container from the context.
Here is my code:
The text was updated successfully, but these errors were encountered: