Reputation: 95
Looking for the best way to Render TilesLayer (all the map) in Canvas instead of image because of lags? Found a "way" with React Leaflet V3.0 but it's not Working in Leaflet V4.0. Any suggestions to help please?
Here is what I Tried : To add L.canvas() in Renderer but there is no Canvas in DOM (EDIT : I open react-leaflet MapContainer.ts and they remove "renderer").
So I Guess the best way is to load like with Vanilla Leaflet in a UseEffect to do it ?
import * as L from "leaflet";
import { MapContainer, TileLayer } from 'react-leaflet';
<MapContainer preferCanvas={true} renderer={L.canvas()} scrollWheelZoom={true}>
<TileLayer maxNativeZoom={mapLayer.Options.maxNativeZoom} key={mapLayer.Url} url={mapLayer.Url}/>
</MapContainer>
Upvotes: 0
Views: 608