MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / DomComponent

Function DomComponent

packages/ui-default/components/react/DomComponent.tsx:5–14  ·  view source on GitHub ↗
(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement })

Source from the content-addressed store, hash-verified

3import React from 'react';
4
5export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement }) {
6 const ref = React.useRef<HTMLDivElement>(null);
7 React.useEffect(() => {
8 ref.current.appendChild(props.childDom);
9 return () => {
10 $(ref.current).empty();
11 };
12 }, []);
13 return <div {...omit(props, 'childDom')} ref={ref}></div>;
14}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected