c2f48ea86d
## Changes see commits ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
33 lines
620 B
TypeScript
33 lines
620 B
TypeScript
import { GetStaticPaths, GetStaticProps } from 'next'
|
|
import { useRouter } from 'next/router'
|
|
|
|
const DynamicPage = () => {
|
|
const { query } = useRouter()
|
|
return (
|
|
<>
|
|
<h1>Dynamic Page</h1>
|
|
<h2>Query: {query.dynamic}</h2>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export const getStaticProps: GetStaticProps = async () => {
|
|
return {
|
|
props: {
|
|
dynamic: 'hello',
|
|
},
|
|
}
|
|
}
|
|
|
|
export const getStaticPaths: GetStaticPaths = async () => {
|
|
return {
|
|
paths: [...Array(10000)].map((_, index) => ({
|
|
params: {
|
|
dynamic: `page-${index}`,
|
|
},
|
|
})),
|
|
fallback: false,
|
|
}
|
|
}
|
|
|
|
export default DynamicPage
|