UNPKG

rasengan

Version:

The modern React Framework

29 lines (28 loc) 1.03 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { hydrateRoot, createRoot } from 'react-dom/client'; import { StrictMode } from 'react'; import { RootComponent } from '../../routing/components/template.js'; const isSpaMode = window.__RASENGAN_SPA_MODE__; export default function renderApp(App, options) { const root = document.getElementById('root'); if (!root) { throw new Error('Root element not found'); } // If SPA mode, render the app if (isSpaMode) { if (options.reactStrictMode) { createRoot(root).render(_jsx(StrictMode, { children: _jsx(App, { Component: RootComponent }) })); } else { createRoot(root).render(_jsx(App, { Component: RootComponent })); } return; } // Handling hydration if (options.reactStrictMode) { hydrateRoot(root, _jsx(StrictMode, { children: _jsx(App, { Component: RootComponent }) })); } else { hydrateRoot(root, _jsx(App, { Component: RootComponent })); } }