🔧 build: make sure we handle the root elements

This commit is contained in:
RiO
2024-12-29 05:57:37 +05:30
parent 77bb95608e
commit b46f14bad9

View File

@@ -1,9 +1,16 @@
import { StrictMode } from 'react'; import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import App from './App.tsx'; import App from './App';
import './index.css'; import './index.css';
createRoot(document.getElementById('root')!).render( // Ensure 'root' element exists to avoid runtime errors
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('Root element not found');
}
const root = createRoot(rootElement);
root.render(
<StrictMode> <StrictMode>
<App /> <App />
</StrictMode> </StrictMode>