( useElement: ElementHook<E, P>, )
| 31 | } |
| 32 | |
| 33 | export 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 | } |
no test coverage detected
searching dependent graphs…