MCPcopy Index your code
hub / github.com/TanStack/query / Project

Function Project

examples/react/suspense/src/components/Project.tsx:7–34  ·  view source on GitHub ↗
({
  activeProject,
  setActiveProject,
}: {
  activeProject: string
  setActiveProject: React.Dispatch<React.SetStateAction<string | null>>
})

Source from the content-addressed store, hash-verified

5import Spinner from './Spinner'
6
7export default function Project({
8 activeProject,
9 setActiveProject,
10}: {
11 activeProject: string
12 setActiveProject: React.Dispatch<React.SetStateAction<string | null>>
13}) {
14 const { data, isFetching } = useSuspenseQuery({
15 queryKey: ['project', activeProject],
16 queryFn: () => fetchProject(activeProject),
17 })
18
19 return (
20 <div>
21 <Button onClick={() => setActiveProject(null)}>Back</Button>
22 <h1>
23 {activeProject} {isFetching ? <Spinner /> : null}
24 </h1>
25 <div>
26 <p>forks: {data.forks_count}</p>
27 <p>stars: {data.stargazers_count}</p>
28 <p>watchers: {data.watchers_count}</p>
29 </div>
30 <br />
31 <br />
32 </div>
33 )
34}

Callers

nothing calls this directly

Calls 2

useSuspenseQueryFunction · 0.90
fetchProjectFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…