Next.js Discord

Discord Forum

Location directories best practice?

Unanswered
Muad'dib posted this in #help-forum
Open in Discord
Avatar
Muad'dibOP
so my tech lead was asking me why I split the pages routes into two for two locations instead of keeping it one

Pages

LocationA
-- homepage.js
---otherpages.js

LocationB
-- homepage.js
---otherpages.js


The user can switch between the two through the use of a button (sets the cookie to AB/BC and then routes them there)

Some pages in AB are AB specific and dont exist in BC and vice versa.

He said this can be done without making two sets of pages like this.




site.com/LocationA/subPages
site.com/LocationB/subPages
I suppose we can do shallow routing and then grab the router object and then fetch the data for the location specific pages on one page without having to split the pages directory into two
(all done in next.js)

0 Replies