MCPcopy
hub / github.com/TanStack/query / createPosts

Function createPosts

examples/solid/basic-graphql-request/src/index.tsx:48–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48function createPosts() {
49 return useQuery(() => ({
50 queryKey: ['posts'],
51 queryFn: async () => {
52 const {
53 posts: { data },
54 } = await request<{ posts: { data: Array<Post> } }>(
55 endpoint,
56 gql`
57 query {
58 posts {
59 data {
60 id
61 title
62 }
63 }
64 }
65 `,
66 )
67 return data
68 },
69 }))
70}
71
72function Posts(props: { setPostId: Setter<number> }) {
73 const state = createPosts()

Callers 1

PostsFunction · 0.70

Calls 1

useQueryFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…