react-leaflet-measure
react-leaflet-measure copied to clipboard
React-Leaflet V3
"export 'withLeaflet' was not found in 'react-leaflet'
is there a solution for V3?
Looking for the solution too
I was able to do it differently.
Add leaflet-measure dependancy.
yarn add leaflet-measure
Import the following:
import * as L from "leaflet"; import 'leaflet-measure'; import 'leaflet-measure/dist/leaflet-measure.css';
On the MapContainer prop whenCreated
whenCreated={(map) => addLeafletMeasureControl(map)}
add the following function.
const addLeafletMeasureControl = (map) =>{ let measureControl = new L.Control.Measure({ position: 'topright', lineColor: 'blue' }); measureControl.addTo(map);
}
It should now work. Hope it helps someone. It could be better if this pluggin was updated. Shalom