chatbot-template/lib/editor/react-renderer.tsx

14 lines
254 B
TypeScript
Raw Normal View History

import { createRoot } from "react-dom/client";
2024-10-30 16:01:24 +05:30
export function renderReactComponent(
component: React.ReactElement,
dom: HTMLElement
) {
const root = createRoot(dom);
root.render(component);
2024-11-01 14:13:17 +05:30
return {
destroy: () => root.unmount(),
};
2024-10-30 16:01:24 +05:30
}