File tree Expand file tree Collapse file tree
basic-graphql-request/src
default-query-function/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,5 +2,6 @@ import ReactDOM from 'react-dom/client'
22
33import App from './App'
44
5- const rootElement = document . getElementById ( 'root' ) as HTMLElement
5+ const rootElement = document . getElementById ( 'root' )
6+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
67ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change @@ -172,5 +172,6 @@ function Post({
172172 )
173173}
174174
175- const rootElement = document . getElementById ( 'root' ) as HTMLElement
175+ const rootElement = document . getElementById ( 'root' )
176+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
176177ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change @@ -96,5 +96,6 @@ function Example() {
9696 )
9797}
9898
99- const rootElement = document . getElementById ( 'root' ) as HTMLElement
99+ const rootElement = document . getElementById ( 'root' )
100+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
100101ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change @@ -146,5 +146,6 @@ function Post({
146146 )
147147}
148148
149- const rootElement = document . getElementById ( 'root' ) as HTMLElement
149+ const rootElement = document . getElementById ( 'root' )
150+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
150151ReactDOM . createRoot ( rootElement ) . render ( < App /> )
Original file line number Diff line number Diff line change @@ -54,5 +54,6 @@ function Example() {
5454 )
5555}
5656
57- const rootElement = document . getElementById ( 'root' ) as HTMLElement
57+ const rootElement = document . getElementById ( 'root' )
58+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
5859ReactDOM . createRoot ( rootElement ) . render ( < App /> )
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 @@ -5,7 +5,8 @@ import { worker } from './api'
55
66worker . start ( )
77
8- const rootElement = document . getElementById ( 'root' ) as HTMLElement
8+ const rootElement = document . getElementById ( 'root' )
9+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
910ReactDOM . createRoot ( rootElement ) . render (
1011 < div style = { { padding : '16px' } } >
1112 < App />
Original file line number Diff line number Diff line change @@ -457,5 +457,6 @@ function patchTodo(todo?: Todo): Promise<Todo> {
457457 } )
458458}
459459
460- const rootElement = document . getElementById ( 'root' ) as HTMLElement
460+ const rootElement = document . getElementById ( 'root' )
461+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
461462ReactDOM . createRoot ( rootElement ) . render ( < Root /> )
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ const router = createBrowserRouter([
6767] )
6868
6969const rootElement = document . getElementById ( 'root' )
70- ReactDOM . createRoot ( rootElement ! ) . render (
70+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
71+ ReactDOM . createRoot ( rootElement ) . render (
7172 < React . StrictMode >
7273 < QueryClientProvider client = { queryClient } >
7374 < RouterProvider router = { router } />
Original file line number Diff line number Diff line change @@ -90,5 +90,6 @@ function Example() {
9090 )
9191}
9292
93- const rootElement = document . getElementById ( 'root' ) as HTMLElement
93+ const rootElement = document . getElementById ( 'root' )
94+ if ( ! rootElement ) throw new Error ( 'Missing #root element' )
9495ReactDOM . createRoot ( rootElement ) . render ( < App /> )
You can’t perform that action at this time.
0 commit comments