2025-09-21 11:02:31 -07:00
|
|
|
import { createRoot } from "react-dom/client";
|
2024-10-30 16:01:24 +05:30
|
|
|
|
2025-09-21 11:02:31 -07:00
|
|
|
// biome-ignore lint/complexity/noStaticOnlyClass: "Needs to be static"
|
2024-10-30 16:01:24 +05:30
|
|
|
export class ReactRenderer {
|
|
|
|
|
static render(component: React.ReactElement, dom: HTMLElement) {
|
|
|
|
|
const root = createRoot(dom);
|
|
|
|
|
root.render(component);
|
2024-11-01 14:13:17 +05:30
|
|
|
|
2024-10-30 16:01:24 +05:30
|
|
|
return {
|
|
|
|
|
destroy: () => root.unmount(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|