We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0607405 commit 6ce930bCopy full SHA for 6ce930b
demos/default/pages/getStaticProps/with-revalidate-404.js
@@ -0,0 +1,35 @@
1
+import Link from 'next/link'
2
+
3
+const Show = ({ show }) => (
4
+ <div>
5
+ <p>
6
+ This page uses getStaticProps() to pre-fetch a TV show, but will return a 404 if the current time ends in 0-4.
7
+ </p>
8
9
+ <hr />
10
11
+ <h1>Show #{show.id}</h1>
12
+ <p>{show.name}</p>
13
14
15
16
+ <Link href="/">
17
+ <a>Go back home</a>
18
+ </Link>
19
+ </div>
20
+)
21
22
+export async function getStaticProps(context) {
23
+ const res = await fetch(`https://api.tvmaze.com/shows/71`)
24
+ const data = await res.json()
25
26
+ return {
27
+ props: {
28
+ show: data,
29
+ },
30
+ notFound: new Date().getMinutes() % 10 < 5,
31
+ revalidate: 60,
32
+ }
33
+}
34
35
+export default Show
0 commit comments