2025-09-21 12:03:29 +01:00
|
|
|
import { createRoot } from 'react-dom/client';
|
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(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|