File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,14 @@ function IsLoggedIn() {
49
49
return data . isLoggedIn ? < Pages /> : < Login /> ;
50
50
}
51
51
52
- const root = ReactDOM . createRoot ( document . getElementById ( 'root' ) ! ) ;
52
+ // Find our rootElement or throw and error if it doesn't exist
53
+ const rootElement = document . getElementById ( 'root' ) ;
54
+ if ( ! rootElement ) throw new Error ( 'Failed to find the root element' ) ;
55
+ const root = ReactDOM . createRoot ( rootElement ) ;
53
56
54
57
injectStyles ( ) ;
55
58
59
+ // Pass the ApolloClient instance to the ApolloProvider component
56
60
root . render (
57
61
< ApolloProvider client = { client } >
58
62
< IsLoggedIn />
Original file line number Diff line number Diff line change @@ -10,11 +10,14 @@ import injectStyles from './styles';
10
10
11
11
injectStyles ( ) ;
12
12
13
- // Pass the ApolloClient instance to the ApolloProvider component
13
+ // Find our rootElement or throw and error if it doesn't exist
14
+ const rootElement = document . getElementById ( 'root' ) ;
15
+ if ( ! rootElement ) throw new Error ( 'Failed to find the root element' ) ;
16
+ const root = ReactDOM . createRoot ( rootElement ) ;
14
17
15
- const root = ReactDOM . createRoot ( document . getElementById ( "root" ) ! ) ;
18
+ // Pass the ApolloClient instance to the ApolloProvider component ;
16
19
root . render (
17
20
< ApolloProvider client = { client } >
18
21
< Pages />
19
22
</ ApolloProvider > ,
20
- ) ;
23
+ ) ;
Original file line number Diff line number Diff line change 1
- import React , { } from 'react' ;
1
+ import React from 'react' ;
2
2
import { gql } from '@apollo/client'
3
3
4
4
export const LAUNCH_TILE_DATA = gql `
You can’t perform that action at this time.
0 commit comments