How to override the parent layout?
Answered
Cuckoo wasp posted this in #help-forum
Cuckoo waspOP
I have a layout in the parent path "app". Inside it, I have "app/dashboard" which has a custom layout to show a deferent header and sidebar for logged in users. The thing is that parent layout is getting rendered first and inside of it the child's layout gets rendered. It isn't getting overridden by the child's layout.
What should I do?
What should I do?
4 Replies
Giant panda
use route groups
Answer
@Giant panda use route groups
Cuckoo waspOP
If I put the parent layout.js and page.js inside a route group, it won't apply to any of it's children, right? What I am trying to do is to override the parent layout only on few specific pages, while it should be as it is in all other child pages.
@Giant panda https://blog.logrocket.com/guide-next-js-layouts-nested-layouts/#managing-layouts-next-js-app-router
Cuckoo waspOP
Yeah, thanks. I grouped different pages to do what I wanted.