UNPKG

@intuitionrobotics/thunderstorm

Version:
22 lines 986 B
import * as React from 'react'; import { Router } from 'react-router-dom'; // noinspection TypeScriptPreferShortImport` import { BrowserHistoryModule } from "../modules/HistoryModule.js"; import { Thunder } from "./Thunder.js"; import { ImplementationMissingException } from "@intuitionrobotics/ts-common"; import { createRoot } from "react-dom/client"; export const AppWrapper = (_props) => { const MainApp = Thunder.getInstance().getMainApp(); if (!MainApp) throw new ImplementationMissingException("mainApp was not specified!!"); return (React.createElement(Router, { history: BrowserHistoryModule.getHistory() }, React.createElement(MainApp, null))); }; export function renderApp(appId = "app") { const el = document.getElementById(appId); if (!el) throw new Error(`Could not find element with id ${appId}`); const root = createRoot(el); root.render(React.createElement(AppWrapper, null)); } //# sourceMappingURL=AppWrapper.js.map