Skip to content

Commit d703819

Browse files
update: examples/react/basic-graphql-request/src/index.jsx
Remove semicolons
1 parent 443b161 commit d703819

File tree

1 file changed

+22
-22
lines changed
  • examples/react/basic-graphql-request/src

1 file changed

+22
-22
lines changed

examples/react/basic-graphql-request/src/index.jsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/* eslint-disable jsx-a11y/anchor-is-valid */
2-
import React from 'react';
3-
import ReactDOM from 'react-dom/client';
2+
import React from 'react'
3+
import ReactDOM from 'react-dom/client'
44
import {
55
useQuery,
66
useQueryClient,
77
QueryClient,
88
QueryClientProvider,
9-
} from '@tanstack/react-query';
10-
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
11-
import { request, gql } from 'graphql-request';
9+
} from '@tanstack/react-query'
10+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
11+
import { request, gql } from 'graphql-request'
1212

13-
const endpoint = 'https://graphqlzero.almansi.me/api';
13+
const endpoint = 'https://graphqlzero.almansi.me/api'
1414

15-
const queryClient = new QueryClient();
15+
const queryClient = new QueryClient()
1616

1717
function App() {
18-
const [postId, setPostId] = React.useState(-1);
18+
const [postId, setPostId] = React.useState(-1)
1919

2020
return (
2121
<QueryClientProvider client={queryClient}>
@@ -36,7 +36,7 @@ function App() {
3636
)}
3737
<ReactQueryDevtools initialIsOpen />
3838
</QueryClientProvider>
39-
);
39+
)
4040
}
4141

4242
function usePosts() {
@@ -57,15 +57,15 @@ function usePosts() {
5757
}
5858
}
5959
`
60-
);
61-
return data;
60+
)
61+
return data
6262
},
63-
});
63+
})
6464
}
6565

6666
function Posts({ setPostId }) {
67-
const queryClient = useQueryClient();
68-
const { status, data, error, isFetching } = usePosts();
67+
const queryClient = useQueryClient()
68+
const { status, data, error, isFetching } = usePosts()
6969

7070
return (
7171
<div>
@@ -104,7 +104,7 @@ function Posts({ setPostId }) {
104104
)}
105105
</div>
106106
</div>
107-
);
107+
)
108108
}
109109

110110
function usePost(postId) {
@@ -122,15 +122,15 @@ function usePost(postId) {
122122
}
123123
}
124124
`
125-
);
126-
return post;
125+
)
126+
return post
127127
},
128128
enabled: postId > -1,
129-
});
129+
})
130130
}
131131

132132
function Post({ postId, setPostId }) {
133-
const { status, data, error, isFetching } = usePost(postId);
133+
const { status, data, error, isFetching } = usePost(postId)
134134

135135
return (
136136
<div>
@@ -153,8 +153,8 @@ function Post({ postId, setPostId }) {
153153
</>
154154
)}
155155
</div>
156-
);
156+
)
157157
}
158158

159-
const rootElement = document.getElementById('root');
160-
ReactDOM.createRoot(rootElement).render(<App />);
159+
const rootElement = document.getElementById('root')
160+
ReactDOM.createRoot(rootElement).render(<App />)

0 commit comments

Comments
 (0)