renderDom.tsx 436 B

1234567891011121314151617
  1. import {render} from 'react-dom';
  2. export function renderDom(
  3. Component: React.ComponentType,
  4. container: string,
  5. props: Record<string, any> = {}
  6. ) {
  7. const rootEl = document.querySelector(container);
  8. // Note: On pages like `SetupWizard`, we will attempt to mount main App
  9. // but will fail because the DOM el wasn't found (which is intentional)
  10. if (!rootEl) {
  11. return;
  12. }
  13. render(<Component {...props} />, rootEl);
  14. }