2025-09-21 11:02:31 -07:00
|
|
|
import { createRoot } from "react-dom/client";
|
2024-10-30 16:01:24 +05:30
|
|
|
|
2026-03-20 09:37:02 +00:00
|
|
|
export function renderReactComponent(
|
|
|
|
|
component: React.ReactElement,
|
|
|
|
|
dom: HTMLElement
|
|
|
|
|
) {
|
|
|
|
|
const root = createRoot(dom);
|
|
|
|
|
root.render(component);
|
2024-11-01 14:13:17 +05:30
|
|
|
|
2026-03-20 09:37:02 +00:00
|
|
|
return {
|
|
|
|
|
destroy: () => root.unmount(),
|
|
|
|
|
};
|
2024-10-30 16:01:24 +05:30
|
|
|
}
|