rsnext/test/integration/prerender/pages/dynamic/[slug].js
Jan Potoms c9492a8cc9
Relax encoding on dynamic prerendered routes (#14717)
It should be enough to encode the characters that `path-to-regexp` uses as path delimiters (`/#?`).

Fixes https://github.com/vercel/next.js/issues/14691
2020-07-13 14:42:27 +00:00

27 lines
567 B
JavaScript

import Link from 'next/link'
export async function getStaticProps({ params: { slug } }) {
return {
props: { slug },
}
}
export async function getStaticPaths() {
return {
paths: [{ params: { slug: '[first]' } }, '/dynamic/[second]'],
fallback: false,
}
}
export default ({ slug }) => {
// Important to not check for `slug` existence (testing that build does not
// render fallback version and error)
return (
<>
<p id="param">Hi {slug}!</p>{' '}
<Link href="/">
<a id="home">to home</a>
</Link>
</>
)
}