skip to Main Content

I am on a next.js project with tailwindcss, but in my src folder I do not have the pages folder and the api subfolder where I have to find the _app.tsx, documents.tsx and index.tsx files, whereas in the tutorial that I am following which dates from 8 months ago there are all these files and folders I nevertheless followed the same procedures what to do in this case?

The global.css file is there which is good, I tried to take the page.tsx file considering it as the index.tsx file, but I can’t find 100% the same type of content

2

Answers


  1. In the new Next.js structure after v 13 the layout.tsx in your is like _app.tsx of old, and page.tsx can be used to adjust the content of the layout file. So you should import your global.css file in layout.tsx, and that should fix your issue mentioned above. I recommend looking more into the documentation on this topic.

    If you’re uncomfortable with the new router structure you could create another Next application and select these options:

    Next options

    This will get you the layout that includes _app.tsx if you would rather go that route.

    Login or Signup to reply.
  2. Next JS has introduced an app router in Next 13. The app router is a little bit different from the page router that we have in older versions. But Next 13 also supports pages router. So you can create a pages directory and create _app and index file or you can create another Next project by selecting pages router to have _app and index as Derek Glassick mentioned.

    You can learn more about the app router and structure at Documentation.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search