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

Function Project

examples/react/suspense/src/components/Project.tsx:7–33  ·  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 projectsQueries.detail(activeProject),
16 )
17
18 return (
19 <div>
20 <Button onClick={() => setActiveProject(null)}>Back</Button>
21 <h1>
22 {activeProject} {isFetching ? <Spinner /> : null}
23 </h1>
24 <div>
25 <p>forks: {data.forks_count}</p>
26 <p>stars: {data.stargazers_count}</p>
27 <p>watchers: {data.subscribers_count}</p>
28 </div>
29 <br />
30 <br />
31 </div>
32 )
33}

Callers

nothing calls this directly

Calls 1

useSuspenseQueryFunction · 0.90

Tested by

no test coverage detected