Next.js Discord

Discord Forum

Location directories best practice?

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


-- homepage.js

-- homepage.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.
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