123456789101112131415161718 |
- import {createRoot} from 'react-dom/client';
- export function renderDom(
- Component: React.ComponentType,
- container: string,
- props: Record<string, any> = {}
- ) {
- const rootEl = document.querySelector(container);
-
-
- if (!rootEl) {
- return;
- }
- const root = createRoot(rootEl);
- root.render(<Component {...props} />);
- }
|