Skip to main content

useMap

function CustomFeature() {
const map = useMap();
const view = map.getView();
return <></>;
}

<div>
<MapContainer center={[126.841784, 35.191406]} width="100%" height="500px">
<CustomFeature />
</MapContainer>
</div>;
  • useMap 훅을 통해 현재 사용하는 지도 인스턴스 객체를 Context로부터 가져와 사용할 수 있습니다.