Skip to content

Commit 5d786f0

Browse files
committed
Go through a pass
1 parent f0f13a6 commit 5d786f0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

final/client/src/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ function IsLoggedIn() {
4949
return data.isLoggedIn ? <Pages /> : <Login />;
5050
}
5151

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);
5356

5457
injectStyles();
5558

59+
// Pass the ApolloClient instance to the ApolloProvider component
5660
root.render(
5761
<ApolloProvider client={client}>
5862
<IsLoggedIn />

start/client/src/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import injectStyles from './styles';
1010

1111
injectStyles();
1212

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);
1417

15-
const root = ReactDOM.createRoot(document.getElementById("root")!);
18+
// Pass the ApolloClient instance to the ApolloProvider component;
1619
root.render(
1720
<ApolloProvider client={client}>
1821
<Pages />
1922
</ApolloProvider>,
20-
);
23+
);

start/client/src/pages/launches.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { } from 'react';
1+
import React from 'react';
22
import { gql } from '@apollo/client'
33

44
export const LAUNCH_TILE_DATA = gql`

0 commit comments

Comments
 (0)