mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This PR updates the with-urql example for using the App Router. Here are the changes that have been made: - I renamed the pages folder and moved it to the app folder. - Added the layout.tsx file as part of the App Router. - Updated the package.json file. CC: @samcx --------- Co-authored-by: MayuriPapat25 <[email protected]> Co-authored-by: samcx <[email protected]>
26 lines
594 B
TypeScript
26 lines
594 B
TypeScript
import Link from "next/link";
|
|
import { getPokemons } from "@/graphql/getPokemons";
|
|
|
|
type Pokemon = {
|
|
image: string;
|
|
name: string;
|
|
__typename: string;
|
|
};
|
|
|
|
export default async function Home() {
|
|
const pokemons = await getPokemons();
|
|
|
|
return (
|
|
<ul>
|
|
{pokemons.map((pokemon: Pokemon) => (
|
|
<li key={pokemon.name}>
|
|
<Link href={`/pokemon/${pokemon.name}`}>
|
|
<h2 style={{ textTransform: "capitalize" }}>{pokemon.name}</h2>
|
|
<img src={pokemon.image} alt={`${pokemon.name} picture`} />
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
);
|
|
}
|