importLfrom'leaflet'import{createPathComponent}from'@react-leaflet/core'import'leaflet.markercluster'functioncreateMarkerCluster({children:_c,...props},context){constclusterProps={}constclusterEvents={}// Splitting props and events to different objectsObject.entries(props).forEach(([propName,prop])=>propName.startsWith('on')?(clusterEvents[propName]=prop):(clusterProps[propName]=prop))constinstance=newL.MarkerClusterGroup(clusterProps)// Initializing event listenersObject.entries(clusterEvents).forEach(([eventAsProp,callback])=>{constclusterEvent=`cluster${eventAsProp.substring(2).toLowerCase()}`instance.on(clusterEvent,callback)})return{instance,context:{...context,layerContainer:instance,},}}constMarkerClusterGroup=createPathComponent(createMarkerCluster)exportdefaultMarkerClusterGroup