MCPcopy
hub / github.com/PaulLeCam/react-leaflet / createLayerHook

Function createLayerHook

packages/core/src/layer.ts:33–46  ·  view source on GitHub ↗
(
  useElement: ElementHook<E, P>,
)

Source from the content-addressed store, hash-verified

31}
32
33export function createLayerHook<E extends Layer, P extends LayerProps>(
34 useElement: ElementHook<E, P>,
35) {
36 return function useLayer(props: P): ReturnType<ElementHook<E, P>> {
37 const context = useLeafletContext()
38 const elementRef = useElement(withPane(props, context), context)
39
40 useAttribution(context.map, props.attribution)
41 useEventHandlers(elementRef.current, props.eventHandlers)
42 useLayerLifecycle(elementRef.current, context)
43
44 return elementRef
45 }
46}

Callers 3

SVGOverlay.tsxFile · 0.90
createLayerComponentFunction · 0.85
createTileLayerComponentFunction · 0.85

Calls 5

useLeafletContextFunction · 0.85
withPaneFunction · 0.85
useAttributionFunction · 0.85
useEventHandlersFunction · 0.85
useLayerLifecycleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…