Group Routing to Base Route
Unanswered
Bigeye tuna posted this in #help-forum
Bigeye tunaOP
When routing, the initial page is found in /src/app/page.tsx where the route is base route '/'
If I create a routing group for, say, user (an individual who is simply logged in), how do I make it so that the user is redirected to the page under /src/app/(user)/page.tsx?
I would like both authenticated and unauthenicated users to have their home page as the base route '/', but I am uncertain how to redirect the logged in user to the desired page. Does it require a wrapper?
If I create a routing group for, say, user (an individual who is simply logged in), how do I make it so that the user is redirected to the page under /src/app/(user)/page.tsx?
I would like both authenticated and unauthenicated users to have their home page as the base route '/', but I am uncertain how to redirect the logged in user to the desired page. Does it require a wrapper?
8 Replies
Brown bear
You probably want conditional routes, which works through parallel routes https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#conditional-routes
By chance, are you coming from Expo? I think I recall that what you were decribing is the approach you would use there.
Bigeye tunaOP
I have used Expo before, yes
Brown bear
Haha, nice. Just had a nagging feeling based on your question lol
Bigeye tunaOP
One of the weird cases where I learned mobile before web haha
Trying to learn Next.js because it seems like a very useful tool
Brown bear
It is very powerful. I do wish that expo had all the features of nextjs; Expo's web offering feels kinda half-baked at the moment. Helpful for a small team who cannot afford to have a separate project for both mobile and web, but it could be better.
Maybe there's potential in the future to merge the two frameworks. Who knows! I know that expo wants to implement server components/actions/etc.