useOlSnapComponent
useOlSnapComponent():
Snap
Defined in: src/ol-snap.tsx:82
Hook to access the OpenLayers Snap interaction instance from the nearest parent OlSnap component. Must be used within a descendant of OlSnap.
Returns
Section titled “Returns”Snap
The OpenLayers Snap interaction instance
Throws
Section titled “Throws”If called outside of an OlSnap component
Example
Section titled “Example”function SnapControl() { const snap = useOlSnapComponent() // Use snap instance return null}