Hello,
I think for micro optimization it would be better to merge index, [slug] and [...slug] into one file:
[[...index]].jsx // or [[...index]].tsx
NextJS handles double square brackets as catch all route and you can merge all content into one file rather than keeping 3 separate files
Now the only adjustment to make is inside getStaticProps
export getStaticProps: GetStaticProps<AppPageProps> = async (props) => {
const { params, preview, previewData, locale, locales, defaultLocale } = props
const slug = params?.index?.length
? params.index !== 'index'
? params.index
: 'home'
: 'home'
(...) // all other content
Hello,
I think for micro optimization it would be better to merge index, [slug] and [...slug] into one file:
NextJS handles double square brackets as catch all route and you can merge all content into one file rather than keeping 3 separate files
Now the only adjustment to make is inside getStaticProps