File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,5 +157,6 @@ function App() {
157157 )
158158}
159159
160- const rootElement = document . getElementById ( 'root' ) as HTMLElement
160+ const rootElement = document . getElementById ( 'root' )
161+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
161162ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change 11import ReactDOM from 'react-dom/client'
22import App from './App'
33
4- const rootElement = document . getElementById ( 'root' ) as HTMLElement
4+ const rootElement = document . getElementById ( 'root' )
5+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
56ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change @@ -45,5 +45,6 @@ function Example() {
4545 )
4646}
4747
48- const rootElement = document . getElementById ( 'root' ) as HTMLElement
48+ const rootElement = document . getElementById ( 'root' )
49+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
4950ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change 11import ReactDOM from 'react-dom/client'
22import App from './App'
33
4- const rootElement = document . getElementById ( 'root' ) as HTMLElement
4+ const rootElement = document . getElementById ( 'root' )
5+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
56ReactDOM . createRoot ( rootElement ) . render ( < App /> )
You can’t perform that action at this time.
0 commit comments