[comment].js 708 字节
Newer Older
J
JJ Kasper 已提交
1
import React from 'react'
2 3
import Link from 'next/link'

J
JJ Kasper 已提交
4 5
// eslint-disable-next-line camelcase
export async function unstable_getStaticParams () {
J
Joe Haddad 已提交
6
  return ['/blog/post-1/comment-1', { post: 'post-2', comment: 'comment-2' }]
J
JJ Kasper 已提交
7
}
8

J
JJ Kasper 已提交
9 10 11 12 13 14 15 16 17 18 19
// eslint-disable-next-line camelcase
export async function unstable_getStaticProps ({ params }) {
  return {
    props: {
      post: params.post,
      comment: params.comment,
      time: new Date().getTime()
    },
    revalidate: 2
  }
}
20

J
JJ Kasper 已提交
21 22 23 24 25 26 27 28 29 30 31 32
export default ({ post, comment, time }) => {
  return (
    <>
      <p>Post: {post}</p>
      <p>Comment: {comment}</p>
      <span>time: {time}</span>
      <Link href='/'>
        <a id='home'>to home</a>
      </Link>
    </>
  )
}