rsnext/test/integration/prerender/pages/catchall/[...slug].js
JJ Kasper 5f5c5e4e9e Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG

* Add test for invalid catchall param in getStaticPaths
2020-01-20 16:44:50 -05:00

19 lines
417 B
JavaScript

export async function unstable_getStaticProps({ params: { slug } }) {
return {
props: {
slug,
},
revalidate: 1,
}
}
export async function unstable_getStaticPaths() {
return [
{ params: { slug: ['first'] } },
'/catchall/second',
{ params: { slug: ['another', 'value'] } },
'/catchall/hello/another',
]
}
export default ({ slug }) => <p id="catchall">Hi {slug.join('/')}</p>