-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathbootstrap.js
More file actions
32 lines (29 loc) · 979 Bytes
/
bootstrap.js
File metadata and controls
32 lines (29 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import App from './components/App';
import React from 'react';
import { createRoot } from 'react-dom/client';
import ErrorBoundary from './components/ErrorBoundary';
// React 18 createRoot API
const container = document.getElementById('root');
const root = createRoot(container);
root.render(
<React.StrictMode>
<ErrorBoundary>
<App />
</ErrorBoundary>
</React.StrictMode>,
);
// Performance monitoring
if (typeof window !== 'undefined' && window.performance) {
window.addEventListener('load', () => {
setTimeout(() => {
const perfData = performance.getEntriesByType('navigation')[0];
console.log('Host App Performance:', {
loadTime: Math.round(perfData.loadEventEnd - perfData.loadEventStart),
domContentLoaded: Math.round(
perfData.domContentLoadedEventEnd - perfData.domContentLoadedEventStart,
),
totalTime: Math.round(perfData.loadEventEnd - perfData.fetchStart),
});
}, 0);
});
}