mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This `draftMode` prop was missing from the previous PR: - https://github.com/vercel/next.js/pull/48669 It was added on `GetStaticPropsContext` but not on `GetServerSidePropsContext` so this PR fixes it. ---------
33 lines
630 B
TypeScript
33 lines
630 B
TypeScript
import Link from 'next/link'
|
|
import type { GetStaticProps } from 'next'
|
|
|
|
type Props = {
|
|
random: number
|
|
draftMode: string
|
|
}
|
|
|
|
export const getStaticProps: GetStaticProps<Props> = ({ draftMode }) => {
|
|
return {
|
|
props: {
|
|
random: Math.random(),
|
|
draftMode: Boolean(draftMode).toString(),
|
|
},
|
|
revalidate: 100000,
|
|
}
|
|
}
|
|
|
|
export default function Another(props: Props) {
|
|
return (
|
|
<>
|
|
<h1>Another</h1>
|
|
<p>
|
|
Draft Mode: <em id="draft">{props.draftMode}</em>
|
|
</p>
|
|
<p>
|
|
Random: <em id="rand">{props.random}</em>
|
|
</p>
|
|
<Link href="/">Go home</Link>
|
|
</>
|
|
)
|
|
}
|