Skip to content

Instantly share code, notes, and snippets.

@isilveira1
Created June 15, 2022 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isilveira1/fbd318eaba63aab9cb85df4f6e075468 to your computer and use it in GitHub Desktop.
Save isilveira1/fbd318eaba63aab9cb85df4f6e075468 to your computer and use it in GitHub Desktop.
import type { GetStaticProps, NextPage } from "next";
import Head from "next/head";
import Link from "next/link";
import { dogs as dogsDB } from "../../db/dogs";
const Doggo: NextPage<{ dogs: Dog[] }> = ({ dogs }) => {
return (
<div>
<Head>
<title>Our Doggos</title>
</Head>
<main>
<h1>Check out our doggos.</h1>
<ul style={{ color: "#0070f3" }}>
{dogs.map((dog) => (
<li key={dog.id}>
<Link href={`/dogs/${dog.id}`}>{dog.name}</Link>
</li>
))}
</ul>
<p style={{ color: "#0070f3" }}>
<Link href="/">Back Home</Link>
</p>
</main>
</div>
);
};
export const getStaticProps: GetStaticProps = async () => {
const dogs = dogsDB;
return {
props: {
dogs,
},
};
};
export default Doggo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment