New to NextJS, figuring out folder structure with app router
Answered
Asian black bear posted this in #help-forum
Asian black bearOP
Hi!
I'm new to Next, and trying to get more familiar with everything it offers. I'm currently trying to get my head round the App Router system.
My goal is to have a neat folder structure.
I have setup the folder structure in the attached image. My understanding is that we need a root page.tsx for the / route, so that contains:
Does this make sense as a functional layout, is there any disadvantages to how I've structured this or a more conventional way i've missed?
Thanks!
I'm new to Next, and trying to get more familiar with everything it offers. I'm currently trying to get my head round the App Router system.
My goal is to have a neat folder structure.
I have setup the folder structure in the attached image. My understanding is that we need a root page.tsx for the / route, so that contains:
import Home from './(layouts)/home'
export default HomeDoes this make sense as a functional layout, is there any disadvantages to how I've structured this or a more conventional way i've missed?
Thanks!
Answered by riský
if you don't specify root page in root, you can still have it in route group to match the
/6 Replies
@Asian black bear Hi!
I'm new to Next, and trying to get more familiar with everything it offers. I'm currently trying to get my head round the App Router system.
My goal is to have a neat folder structure.
I have setup the folder structure in the attached image. My understanding is that we need a root page.tsx for the / route, so that contains:
js
import Home from './(layouts)/home'
export default Home
Does this make sense as a functional layout, is there any disadvantages to how I've structured this or a more conventional way i've missed?
Thanks!
if you don't specify root page in root, you can still have it in route group to match the
/Answer
as long as no double ups
@riský if you don't specify root page in root, you can still have it in route group to match the `/`
Asian black bearOP
Ok cool, so this would make more sense?
With home content in that top level page.tsx?
With home content in that top level page.tsx?
try and see 🙂
but in theory it looks right
@riský try and see 🙂
Asian black bearOP
Its functional, just more of a question of convention or any gotchas i havent considered, but thanks!