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
In the new Next.js structure after v 13 the
layout.tsx
in your is like_app.tsx
of old, andpage.tsx
can be used to adjust the content of the layout file. So you should import yourglobal.css
file inlayout.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:
This will get you the layout that includes
_app.tsx
if you would rather go that route.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.