Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

index.js

31 lines769 Bytes

1import React from 'react'
2import Link from 'next/link'
3import useProjects from '../hooks/use-projects'
4​
5export default () => {
6 const { data, isLoading, isFetching } = useProjects()
7​
8 return (
9 <div style={{ textAlign: 'center' }}>
10 <h1>Trending Projects</h1>
11 <div>
12 {isLoading ? (
13 'Loading...'
14 ) : data ? (
15 <>
16 <div>
17 {data.map(project => (
18 <p key={project}>
19 <Link href="/[user]/[repo]" as={`/${project}`}>
20 <a>{project}</a>
21 </Link>
22 </p>
23 ))}
24 </div>
25 <div>{isFetching ? 'Background Updating...' : ' '}</div>
26 </>
27 ) : null}
28 </div>
29 </div>
30 )