componentDidMount() { const leafletMap = this.leafletMap.leafletElement; leafletMap.on('zoomend', () => { const updatedZoomLevel = leafletMap.getZoom(); this.handleZoomLevelChange(updatedZoomLevel); }); }
componentDidMount() { const props = omit(this.props, OTHER_PROPS) this.leafletElement = this.createLeafletElement(props) this.leafletElement.on('move', this.onViewportChange) this.leafletElement.on('moveend', this.onViewportChanged) if (props.bounds != null) { this.leafletElement.fitBounds(props.bounds, props.boundsOptions) } if (this.props.whenReady) { this.leafletElement.whenReady(this.props.whenReady) } this.contextValue = { layerContainer: this.leafletElement, map: this.leafletElement, } super.componentDidMount() this.forceUpdate() // Re-render now that leafletElement is created }