react-leaflet-measure installiation problem in react-leaflet version 4

82 Views Asked by At

I am using react-leaflet version 4 and want to installed react-leaflet-measure. after installing and doing configuration i got 'Uncaught TypeError: Super expression must either be null or a function, not undefined', as I understand it because react-leaflet version 4 use functional components and my desired plugin wants class based components

    const Map = () => {
    const position = [51.505, -0.09];
    const measureOptions = {
        position: 'topright',
        primaryLengthUnit: 'meters',
        secondaryLengthUnit: 'kilometers',
        primaryAreaUnit: 'sqmeters',
        secondaryAreaUnit: 'acres',
        activeColor: '#db4a29',
        completedColor: '#9b2d14'
    };
  return (
    <div>
        <MapContainer center={position} zoom={13} style={{ height: "100vh" }}>
            <TileLayer
                attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
            />
            <MeasureControl {...measureOptions} />
        </MapContainer>
    </div>
  );
};

export default Map;
0

There are 0 best solutions below