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

Function usePosts

examples/react/basic/src/index.tsx:26–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26function usePosts() {
27 return useQuery({
28 queryKey: ['posts'],
29 queryFn: async (): Promise<Array<Post>> => {
30 const response = await fetch('https://jsonplaceholder.typicode.com/posts')
31 return await response.json()
32 },
33 })
34}
35
36function Posts({
37 setPostId,

Callers 1

PostsFunction · 0.70

Calls 1

useQueryFunction · 0.90

Tested by

no test coverage detected