Skip to content

Commit

Permalink
update: examples/react/basic-graphql-request/src/index.jsx
Browse files Browse the repository at this point in the history
Remove semicolons
  • Loading branch information
sunil-sharma-999 authored Jun 12, 2024
1 parent 443b161 commit d703819
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions examples/react/basic-graphql-request/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react';
import ReactDOM from 'react-dom/client';
import React from 'react'
import ReactDOM from 'react-dom/client'
import {
useQuery,
useQueryClient,
QueryClient,
QueryClientProvider,
} from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { request, gql } from 'graphql-request';
} from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { request, gql } from 'graphql-request'

const endpoint = 'https://graphqlzero.almansi.me/api';
const endpoint = 'https://graphqlzero.almansi.me/api'

const queryClient = new QueryClient();
const queryClient = new QueryClient()

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

return (
<QueryClientProvider client={queryClient}>
Expand All @@ -36,7 +36,7 @@ function App() {
)}
<ReactQueryDevtools initialIsOpen />
</QueryClientProvider>
);
)
}

function usePosts() {
Expand All @@ -57,15 +57,15 @@ function usePosts() {
}
}
`
);
return data;
)
return data
},
});
})
}

function Posts({ setPostId }) {
const queryClient = useQueryClient();
const { status, data, error, isFetching } = usePosts();
const queryClient = useQueryClient()
const { status, data, error, isFetching } = usePosts()

return (
<div>
Expand Down Expand Up @@ -104,7 +104,7 @@ function Posts({ setPostId }) {
)}
</div>
</div>
);
)
}

function usePost(postId) {
Expand All @@ -122,15 +122,15 @@ function usePost(postId) {
}
}
`
);
return post;
)
return post
},
enabled: postId > -1,
});
})
}

function Post({ postId, setPostId }) {
const { status, data, error, isFetching } = usePost(postId);
const { status, data, error, isFetching } = usePost(postId)

return (
<div>
Expand All @@ -153,8 +153,8 @@ function Post({ postId, setPostId }) {
</>
)}
</div>
);
)
}

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

0 comments on commit d703819

Please sign in to comment.