Skip to content

useOlOverlayComponent

useOlOverlayComponent(): Overlay

Defined in: src/ol-overlay-component.tsx:105

Hook to access the OpenLayers Overlay instance from the nearest parent OlOverlay component. Must be used within a descendant of OlOverlay.

Overlay

The OpenLayers Overlay instance

If called outside of an OlOverlay component

function OverlayContent() {
const overlay = useOlOverlayComponent()
// Use overlay instance
return <div>Content</div>
}