Nextjs project questions/issues
Unanswered
Crème D’Argent posted this in #help-forum
Crème D’ArgentOP
Im trying to create a project, but am facing a few issues
17 Replies
Crème D’ArgentOP
so what i want to achieve is, i want my welcome page, to become my root page,
This is what am getting
Transvaal lion
Root page is the page in App
@Transvaal lion Root page is the page in App
Crème D’ArgentOP
yes, im aware of that
Transvaal lion
So if you want it on / instead of /welcome you move it one up no?
Crème D’ArgentOP
i thought that you just import that page? like you will do in React no?
Transvaal lion
No the router for Next js doesn't require you to import it etc, it will automatically do routing based on your folder structure
@Transvaal lion No the router for Next js doesn't require you to import it etc, it will automatically do routing based on your folder structure
Crème D’ArgentOP
yes, im aware of that too
so how do i achieve what i want
Transvaal lion
If you want welcome to be the page at / it needs to be the page file in the root folder of app
so app/page.js
Crème D’ArgentOP
oh okay, so i cant do it in other ways?
or is that the recommend way?
Transvaal lion
If you want to use a more import style, then you could create a folder for components and then import the welcome component in your root folder page.js for example
but it's effectively the same, you're just inlining something you cannot re-use most likely (a welcome page)
@Crème D’Argent or is that the recommend way?
Transvaal lion
that's the default and recommended way as far as I'm aware for Next JS yeah, I believe you can disable it also, but I'm not sure what the use case for that would be in your situation. It also took me a bit to get used too but imo it works well once you get used to it