Introduction
Getting Started
Last updated
Getting Started
Last updated
yarn add react-leaflet-clusternpm i react-leaflet-cluster"react": "16.x",
"leaflet": "1.7.x",
"react-leaflet": "3.0.x"import MarkerClusterGroup from 'react-leaflet-cluster'
import {MapContainer, Marker } from 'react-leaflet'
import 'leaflet/dist/leaflet.css'
import {addressPoints} from './realworld'
const Demo = () => {
return (
<MapContainer
style={{height: '500px'}}
center={[38.9637, 35.2433]}
zoom={6}
scrollWheelZoom={true}
>
<MarkerClusterGroup
chunkedLoading
>
{(addressPoints as AdressPoint).map((address, index) => (
<Marker
key={index}
position={[address[0], address[1]]}
title={address[2]}
icon={customIcon}
></Marker>
))}
</MarkerClusterGroup>
</MapContainer>
)
}