PaulLeCam / react-leaflet

React components for Leaflet maps
https://react-leaflet.js.org
Other
5.16k stars 886 forks source link

Re-add `whenCreated` to MapContainer or allow class based React projects access to `Map` without hooks #1138

Open mikebrucker opened 4 months ago

mikebrucker commented 4 months ago

I am upgrading a company React project and we use class based components. Version 4 of react-leaflet does not allow access to Map without using the useMap hook. We need to be able to keep our code consistent and not be forced to use hooks.

Bug report in v4

Before opening an issue, make sure to read the contributing guide and understand this is a bug tracker, not a support platform.

Please make sure to check the following boxes before submitting an issue.\ Issues opened without using this template will be closed unless they have a good reason not to follow this template.

Expected behavior

Access to Map is doable in class based components without hooks.

Actual behavior

In version 4 we are forced to use hooks.