next.js - 为什么 Next.js 在 app.js 前面加上下划线?

标签 next.js

当我使用 npx create-next-app 创建 Next.js 项目时命令比有一个 _app.js pages下的文件文件夹。在哪种情况下,我需要在 Next.js 项目中为文件添加下划线前缀?

最佳答案

  • Custom App

  • Next.js 使用 App用于初始化页面的组件。

    To override the default App, create the file ./pages/_app.js


  • Custom Document

  • 定制Document通常用于增强应用程序的 <html><body>标签。

    To override the default Document, create the file ./pages/_document.js

    关于next.js - 为什么 Next.js 在 app.js 前面加上下划线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65857281/

    相关文章:

    reactjs - NextJS : how to Link to new page with current page slugs?

    javascript - Next.js 类型错误 : Cannot set properties of undefined (setting 'hook' )

    javascript - Vercel Next js 未捕获( promise )ChunkLoadError : Loading chunk 0 failed

    javascript - 使用 nextjs 放大时,React Image Magnifiers 不起作用

    next.js - 为什么在NextJS生产阶段没有定义tailwind中的自定义颜色

    node.js - 快速服务器重定向问题

    reactjs - 如何/在何处将模型/ Controller 放入下一个 js 应用程序?

    javascript - 在不刷新页面的情况下更改 URl NEXT.JS

    next.js - 使用 Next.js 13(应用程序路由器方法)结构将 RecoilRoot 集成到 Next.js 中

    reactjs - 在 Next Js 中编辑 CSS-loader localIdentName 以对用户隐藏类名