Replies: 5 comments 4 replies
-
The feature requests talking about this are readily closed by NextJS maintainers, who say that the behavior is intentional because the layout doesn't re-render for different pages: What is, then, their excuse for templates? How come templates do not have access to the current route? |
Beta Was this translation helpful? Give feedback.
-
This article is inaccurate and I would highly recommend not following the patterns it is showing. Futher, I would recommend to the authors to remove this utility from their package, as it is likely to break. Please see this comment for the correct answer: #43704 (comment) |
Beta Was this translation helpful? Give feedback.
-
@leerob Still no explanation why TEMPLATES cannot access the path of the current page being rendered under them. |
Beta Was this translation helpful? Give feedback.
-
The DX of next has definitely dropped from 9/10 about 2-3 years ago, to 3/10 at best now |
Beta Was this translation helpful? Give feedback.
-
Is there any clarity now on why page templates (as opposed to layout templates) cannot access the current path name @leerob ? I also don't understand why it's not possible given that Is it because server components are used/cached across different routes regardless of if they're in a page or a layout template? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Do you think the existence of an article like this: https://www.propelauth.com/post/getting-url-in-next-server-components, or issues like this shows us that the developer experience is bad in this area?
216 votes ·
Beta Was this translation helpful? Give feedback.
All reactions