Next.js · Junior · Question 28 of 75
Why give a folder a name with an underscore, e.g. app/_components?
- ✓Correct answer: It's a private folder: it and its files are excluded from routing
- 2The underscore makes the components in the folder client components
- 3It tells Next.js to minify those files more aggressively
Explanation
Private folders explicitly separate helper code from routes. Strictly speaking, files without page/route aren't public anyway, but _ protects against accidentally creating a route and makes the structure clearer.