Is this the right approach?
Answered
White-horned horntail posted this in #help-forum
White-horned horntailOP
Easiest way to explain this is if you look at vercel.com/account and click through the navigation bar on the left, it navigates you to different pages
I want to do something similar since I am also creating a settings page.
Is the best approach to use route groups and just put the left navigation bar in the layout.js so that it persists through /settings/General, /settings/teams/ settings/tokens.,,etc?
I want to do something similar since I am also creating a settings page.
Is the best approach to use route groups and just put the left navigation bar in the layout.js so that it persists through /settings/General, /settings/teams/ settings/tokens.,,etc?
12 Replies
@White-horned horntail Easiest way to explain this is if you look at vercel.com/account and click through the navigation bar on the left, it navigates you to different pages
I want to do something similar since I am also creating a settings page.
Is the best approach to use route groups and just put the left navigation bar in the layout.js so that it persists through /settings/General, /settings/teams/ settings/tokens.,,etc?
You can put the left bar in settings/layout.tsx
Answer
White-horned horntailOP
Is this the correct way to do it?
in Mainlayout, its just my regular pages etc... in settings page I want to persist the left navigation bar, so I created a seperate route group and all I did was add that left nav bar to the layout.tsx in (settingsLayout). each nested folder contains a page.tsx
@White-horned horntail Is this the correct way to do it?
Well, you can do it without having to make a route group for settings but if this works it’s good too no problems
White-horned horntailOP
How does that approach look like?
settings/layout.tsx <- sidebar here
settings/page.tsx <- have the sidebar
settings/whatever/page.tsx <- also have the sidebar
settings/page.tsx <- have the sidebar
settings/whatever/page.tsx <- also have the sidebar
White-horned horntailOP
Oh so you're saying basically just put the side bar code for all those page.tsx?
Like all these would have the sidebar code inside?
@White-horned horntail Oh so you're saying basically just put the side bar code for all those page.tsx?
No. Put it inside settings/layout.tsx, then all pages starting with /settings will get the sidebar
White-horned horntailOP
Oh I didn't think you can have nested layouts like that.
thought it was one layout per group