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'
44import {
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
1717function 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
4242function usePosts ( ) {
@@ -57,15 +57,15 @@ function usePosts() {
5757 }
5858 }
5959 `
60- ) ;
61- return data ;
60+ )
61+ return data
6262 } ,
63- } ) ;
63+ } )
6464}
6565
6666function 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
110110function 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
132132function 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