Skip to content

Commit 713d354

Browse files
committed
refactor: update main entry point to use createRoot for React 18 compatibility
1 parent 768c93c commit 713d354

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/main.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import './patch-local-storage-for-github-pages';
22

3-
import React, {StrictMode} from 'react'
4-
import { render } from 'react-dom';
5-
import App from './App'
6-
import './index.scss'
7-
import eruda from "eruda";
3+
import React from 'react';
4+
import { createRoot } from 'react-dom/client';
5+
import App from './App';
6+
import './index.scss';
7+
import eruda from 'eruda';
88

99
eruda.init();
1010

11-
render(
12-
<StrictMode>
13-
<App />
14-
</StrictMode>,
15-
document.getElementById('root') as HTMLElement
16-
)
11+
const container = document.getElementById('root');
12+
if (!container) throw new Error('Root element not found');
13+
14+
createRoot(container).render(
15+
<React.StrictMode>
16+
<App />
17+
</React.StrictMode>
18+
);

0 commit comments

Comments
 (0)