index.js 2.8 KB
Newer Older
1 2
import Link from 'next/link'

3
export async function getStaticProps() {
4
  // throw new Error('oops from getStaticProps')
J
JJ Kasper 已提交
5 6 7
  return {
    props: { world: 'world', time: new Date().getTime() },
    // bad-prop
T
Tim Neutkens 已提交
8
    revalidate: 1,
J
JJ Kasper 已提交
9 10 11
  }
}

J
JJ Kasper 已提交
12
const Page = ({ world, time }) => {
13 14
  return (
    <>
15
      {/* <div id='after-change'>idk</div> */}
16
      <p>hello {world}</p>
J
JJ Kasper 已提交
17
      <span>time: {time}</span>
18 19 20 21
      <Link href="/non-json/[p]" as="/non-json/1">
        <a id="non-json">to non-json</a>
      </Link>
      <br />
22
      <Link href="/another?hello=world" as="/another/?hello=world">
23
        <a id="another">to another</a>
24 25
      </Link>
      <br />
26 27
      <Link href="/something">
        <a id="something">to something</a>
28 29
      </Link>
      <br />
30 31
      <Link href="/normal">
        <a id="normal">to normal</a>
32 33
      </Link>
      <br />
34 35
      <Link href="/blog/[post]" as="/blog/post-1">
        <a id="post-1">to dynamic</a>
36
      </Link>
J
JJ Kasper 已提交
37 38 39
      <Link href="/blog/[post]" as="/blog/post-100">
        <a id="broken-post">to broken</a>
      </Link>
J
Joe Haddad 已提交
40
      <Link href="/blog/[post]" as="/blog/post-999" prefetch={false}>
41 42
        <a id="broken-at-first-post">to broken at first</a>
      </Link>
43
      <br />
44 45
      <Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
        <a id="comment-1">to another dynamic</a>
46
      </Link>
47 48 49
      <Link href="/catchall/[...slug]" as="/catchall/first">
        <a id="to-catchall">to catchall</a>
      </Link>
50
      <br />
51 52 53 54
      <Link href="/index">
        <a id="to-nested-index">to nested index</a>
      </Link>
      <br />
55 56 57 58
      <Link href="/lang/[lang]/about?lang=en" as="/about">
        <a id="to-rewritten-ssg">to rewritten static path page</a>
      </Link>
      <br />
59 60 61 62 63 64
      <Link href="/catchall-optional/[[...slug]]" as="/catchall-optional">
        <a id="catchall-optional-root">to optional catchall root</a>
      </Link>
      <Link href="/catchall-optional/[[...slug]]" as="/catchall-optional/value">
        <a id="catchall-optional-value">to optional catchall page /value</a>
      </Link>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
      <br />
      <Link href="/dynamic/[slug]" as="/dynamic/[first]">
        <a id="dynamic-first">to dynamic [first] page</a>
      </Link>
      <Link href="/dynamic/[slug]" as="/dynamic/[second]">
        <a id="dynamic-second">to dynamic [second] page</a>
      </Link>
      <br />
      <Link
        href="/catchall-explicit/[...slug]"
        as="/catchall-explicit/[first]/[second]"
      >
        <a id="catchall-explicit-string">
          to catchall-explicit [first]/[second] page
        </a>
      </Link>
      <Link
        href="/catchall-explicit/[...slug]"
        as="/catchall-explicit/[third]/[fourth]"
      >
        <a id="catchall-explicit-object">
          to catchall-explicit [third]/[fourth] page
        </a>
      </Link>
89 90 91 92 93
    </>
  )
}

export default Page