NextJS is confusing to me. All official examples and many (most, all?) tutorials that I've read including the official documentation are organizing the application with a pages-directory (and, if necessary, an api-directory for backend services). They claim that every file below the pages-directory will automatically reflect a corresponding route-name.
However, when creating a new NextJS app with npx create-next-app@latest, I get a total different setup. It contains an folder called app and not pages. Furthermore, the app-folder contain a file page.txs as a synonym what previously was index.tsx in the pages-folder.
In these tutorials and docs, there is the concept of overwriting the system-App-component with placing a file pages/_app.tsx. I can't find anything how to do this with the new directory-scheme.
Tutorials and Docs:
- package.json - next.config.js + pages - _app.tsx - _document.tsx - about.tsx - index.tsx + public - favicon.ico New Scaffold:
+ app - favicon.ico - globals.css - layout.tsx - page.tsx - next.config.hs - package.json What happened to NextJS? What is right? Is the scaffold wrong that npx create-next-app@latest will create or is there another version of documentation that I can't find?
In case of the new scaffold is the right version, how can I place new routes and sub-pages inside the app-directory? Is the concept of having an api-directory still valid?
I hope someone can shed some light here for me regarding latest evolvement of NextJS. Thank you!