chatbot-template/lib/editor/react-renderer.tsx
2025-09-21 19:02:31 +01:00

13 lines
342 B
TypeScript

import { createRoot } from "react-dom/client";
// biome-ignore lint/complexity/noStaticOnlyClass: "Needs to be static"
export class ReactRenderer {
static render(component: React.ReactElement, dom: HTMLElement) {
const root = createRoot(dom);
root.render(component);
return {
destroy: () => root.unmount(),
};
}
}