MCPcopy Create free account
hub / github.com/TanStack/query / getPostById

Function getPostById

examples/react/basic/src/index.tsx:84–89  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

82}
83
84const getPostById = async (id: number): Promise<Post> => {
85 const response = await fetch(
86 `https://jsonplaceholder.typicode.com/posts/${id}`,
87 )
88 return await response.json()
89}
90
91function usePost(postId: number) {
92 return useQuery({

Callers 1

usePostFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected