You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
413 B
TypeScript
14 lines
413 B
TypeScript
import React from 'react';
|
|
import { omit } from 'lodash';
|
|
|
|
export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement }) {
|
|
const ref = React.useRef<HTMLDivElement>();
|
|
React.useEffect(() => {
|
|
ref.current.appendChild(props.childDom);
|
|
return () => {
|
|
$(ref.current).empty();
|
|
};
|
|
});
|
|
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
|
}
|