Best practices: Should generateStaticParams be written on layout.tsx or page.tsx ? #75677
Unanswered
nicolas-zozol
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
If I understand correctly,
generateStaticParams
andgenerateMetadata
can be written at both files, andpage.tsx
takes precedence onlayout.tsx
.layout.tsx
is facultative. For what I tested, metadata will be generated by the closest parent found. Sopage.tsx
, and if not found inpage.tsx
, the closestlayout.tsx
found in the tree.But I don't feel it makes that sense for
generateStaticParams
to generate path also for children. It may work but is probably a bad idea.So what is the best practice before I ship to users a framework I will not control later ?
Beta Was this translation helpful? Give feedback.
All reactions