Thank you Nasir, this helped to orient me, but I am using react-leaflet with React 18 and a mapRef = useRef(); a MapContainer component passing it this ref, how would i perform the check then ?