Download next.js/examples/api-routes-apollo-server/pages/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 618 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server/pages/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/api-routes-apollo-server/pages/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server/pages/index.tsx
618 Bytes
| import Link from "next/link"; | |
| import queryGraphql from "../shared/query-graphql"; | |
| export default function UserListing({ users }) { | |
| return ( | |
| <div> | |
| <h1>User Listing</h1> | |
| <ul> | |
| {users.map((user) => ( | |
| <li key={user.username}> | |
| <Link href="/[username]" as={`/${user.username}`}> | |
| {user.name} | |
| </Link> | |
| </li> | |
| ))} | |
| </ul> | |
| </div> | |
| ); | |
| } | |
| export async function getStaticProps() { | |
| const { users } = await queryGraphql(` | |
| query { | |
| users { | |
| name | |
| username | |
| } | |
| } | |
| `); | |
| return { props: { users } }; | |
| } | |