Unable to remove react-leaflet Map with MapControl in React

749 Views Asked by At

I created map legend in Leaflet map using MapControl. Everything working well but when I try to remove Map component I have error Uncaught TypeError: Cannot read property 'remove' of undefined from MapControl.js. Does anyone have any idea how to fix it?

Below is example in codesandbox - after 5 seconds I removed map and changed content. https://codesandbox.io/s/how-to-add-a-legend-to-the-map-using-react-leaflet-forked-if0q4?file=/src/Map.js

0

There are 0 best solutions below