import React from 'react' import Link from 'next/link' import { useQuery } from '@tanstack/react-query' import { usePathname } from 'next/navigation' async function fetchProject(id: string): Promise<{ forks_count: number stargazers_count: number watchers_count: number }> { console.info('Fetching project:', id) const response = await fetch(`https://api.github.com/repos/${id}`) await new Promise((r) => setTimeout(r, 1000)) return await response.json() } export default function Repo() { const id = usePathname() const { status, data, error, isFetching } = useQuery({ queryKey: ['team', id], queryFn: () => fetchProject(id), }) return (
forks: {data.forks_count}
stars: {data.stargazers_count}
watchers: {data.watchers_count}