I'm trying to add map on the canvas and put tiles there with react-leaflet library v3.X. At the moment tiles are displaying as <img>
in HTML. In latest versions of react-leaflet there isn't Map object there is MapContainer object only. So I can't add property preferCanvas=true to MapContainer. It is noteworthy that in old versions of react-leaflet there was Map object with preferCanvas option but then it was removed. I think another way to add map to canvas exists. Please, help.
import React, { useState, useEffect, useRef } from "react";
import { MapContainer as LeafletMap, TileLayer } from "react-leaflet";
// some code skipped
return (
<LeafletMap
preferCanvas={true} // не работает
center={[51.65, 103.72]}
zoom={14}
maxZoom={16}
attributionControl={true}
zoomControl={true}
doubleClickZoom={false}
scrollWheelZoom={true}
dragging={true}
animate={true}
easeLinearity={0.35}
whenReady={(map) => {
setMapReady(true);
}}
>
<TileLayer
url="https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}"
id="mapbox/outdoors-v11"
/>
</LeafletMap>
);
}