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

Function Project

examples/solid/suspense/src/components/Project.tsx:7–34  ·  view source on GitHub ↗
(props: {
  activeProject: string
  setActiveProject: (project: string | null) => void
})

Source from the content-addressed store, hash-verified

5import Spinner from './Spinner'
6
7export default function Project(props: {
8 activeProject: string
9 setActiveProject: (project: string | null) => void
10}) {
11 const projectQuery = useQuery(() => ({
12 ...projectsQueries.detail(props.activeProject),
13 throwOnError: true,
14 }))
15
16 return (
17 <div>
18 <Button onClick={() => props.setActiveProject(null)}>Back</Button>
19 <h1>
20 {props.activeProject}{' '}
21 <Show when={projectQuery.isFetching}>
22 <Spinner />
23 </Show>
24 </h1>
25 <div>
26 <p>forks: {projectQuery.data?.forks_count}</p>
27 <p>stars: {projectQuery.data?.stargazers_count}</p>
28 <p>watchers: {projectQuery.data?.subscribers_count}</p>
29 </div>
30 <br />
31 <br />
32 </div>
33 )
34}

Callers

nothing calls this directly

Calls 1

useQueryFunction · 0.90

Tested by

no test coverage detected