Can a layout file be used without a page file?
Answered
Satin Angora posted this in #help-forum
Satin AngoraOP
On the root of the related segment, there is no need for a page file; but considering there is common layout for each sub-segment, I want to define a layout file in the segment root. Here is related architecture
- app/
- [lang]/
- segment/
- subsegment/
- layout.tsx
- page.tsx
- layout.tsx
- layout.tsx
- page.tsx Is there a problem with such approach?5 Replies
Giant panda
That should be completely valid at a first glance.
Answer
Giant panda
You just have to keep in mind that you end up with a non-routeable path
/segment, but if you don't mind that it's fine.Satin AngoraOP
That is expected. I couldn't decide if I should make all sections of my dashboard tabs or separate URLs, and I decided to go with the latter.
Having a non-routable path seems weird, but I wanted all sections to route under the path
root/dashboard/sectionI am still not sure if it is a good idea or not