Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
639 views
in Technique[技术] by (71.8m points)

Why does Next.js prefix the app.js with an underscore?

When I create a Next.js project with the npx create-next-app command than there is an _app.js file under the pages folder. In which case do I need to prefix a file with an underscore in a Next.js project?

question from:https://stackoverflow.com/questions/65857281/why-does-next-js-prefix-the-app-js-with-an-underscore

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're only gonna need that prefix in the default nextjs pages like _app.js, the _document.js, etc. you can look it up in the Next.js Docs, I think the prefix is used to avoid routes like "/app" or "/document", and let them free in case you need use them for your project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...