英文:
Different file-structure is created in my project than my tutor's , is that fine?
问题
我刚刚开始学习Next.js,我正在学习的视频中显示,创建一个Next.js项目后,文件结构与我的项目不同。
在我的导师的视频中,src文件夹中有独立的文件夹,分别包含像_app.js、_document.js和index.js这样的文件,而如果我创建一个新项目,我会得到一个不同的文件结构,src中只有一个名为app的文件夹,其中包含global.css、layout.js和page.js这些文件。
我对为什么不同感到困惑,如果我继续使用这样的文件结构,我的项目会不会出现问题,我认为_app.js是一个非常重要的文件,但在我的项目中它不同。
英文:
I have just begun to learn Next.js and the video I was learning from shows a different file structure after creating a Next.js project from mine.
In my tutor's video, in src folder there are separate folders for pages and styles that contains files like _app.js, _document.js, and index.js whereas if I create a new project I get a different file structure with a single folder in src named app with files global.css, layout.js, page.js only.
I am confused about why it's different & will there be any problems in my project if I move ahead with such file structure also I think _app.js is a really important file but its different in mine.
答案1
得分: 0
你正在使用Next.js的新应用程序路由器,而你的导师正在使用旧的页面目录。它们之间有一些相当大的差异,因此你可能希望使用以下命令重新创建项目:npx create-next-app@latest,当提示你是否要使用应用程序路由器时,请选择"no"。
英文:
You are using nextjs's new app router, and your tutor is using the older pages directory. There are some pretty big differences, so you might want to remake your project using npx create-next-app@latest and when you are prompted on whether you want to use the app router, select no.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论