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

Function createContainerComponent

packages/core/src/component.tsx:23–37  ·  view source on GitHub ↗
(
  useElement: ElementHook<E, PropsWithoutRef<P>>,
)

Source from the content-addressed store, hash-verified

21}>
22
23export function createContainerComponent<E, P extends PropsWithChildren>(
24 useElement: ElementHook<E, PropsWithoutRef<P>>,
25) {
26 function ContainerComponent(props: PropsWithoutRef<P>, forwardedRef: Ref<E>) {
27 const { instance, context } = useElement(props).current
28 useImperativeHandle(forwardedRef, () => instance)
29
30 const { children } = props as PropsWithChildren
31 return children == null ? null : (
32 <LeafletContext value={context}>{children}</LeafletContext>
33 )
34 }
35
36 return forwardRef(ContainerComponent)
37}
38
39export function createDivOverlayComponent<
40 E extends DivOverlay,

Callers 4

components.tsxFile · 0.90
LayersControl.tsxFile · 0.90
createLayerComponentFunction · 0.85
createPathComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…