This repository has been archived by the owner on May 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for statically routed SSG pages
Copy pre-rendered pages with SSG to Netlify publish directory and copy SSG page JSON data to _next/data/ directory. See: #7
- Loading branch information
Showing
14 changed files
with
461 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Link from 'next/link' | ||
|
||
const Show = ({ show }) => ( | ||
<div> | ||
<p> | ||
This page uses getStaticProps() to pre-fetch a TV show. | ||
</p> | ||
|
||
<hr/> | ||
|
||
<h1>Show #{show.id}</h1> | ||
<p> | ||
{show.name} | ||
</p> | ||
|
||
<hr/> | ||
|
||
<Link href="/"> | ||
<a>Go back home</a> | ||
</Link> | ||
</div> | ||
) | ||
|
||
export async function getStaticProps(context) { | ||
|
||
const res = await fetch(`https://api.tvmaze.com/shows/71`); | ||
const data = await res.json(); | ||
|
||
return { | ||
props: { | ||
show: data | ||
} | ||
} | ||
} | ||
|
||
export default Show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.