Next.js Discord

Discord Forum

[Tutorial] Why do we not opt out the /lib and /ui from routing via `_` prefix?

Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
- `/app`: Contains all the routes, components, and logic for your application, this is where you'll be mostly working from.
- `/app/lib`: Contains functions used in your application, such as reusable utility functions and data fetching functions.
- `/app/ui`: Contains all the UI components for your application, such as cards, tables, and forms. To save time, we've pre-styled these components for you.
- `/public`: Contains all the static assets for your application, such as images.
- `/scripts`: Contains a seeding script that you'll use to populate your database in a later chapter.

Should we be renaming these to /app/_lib and /app/_ui?

2 Replies

You can, for that extra safety. I assume that's from the next/learn.

_ makes a route unroutable but as long you dont have route.ts|js or page.ts|js, there wont be much if a issue.
good question. yeah i agree with you, while they can use app/ui app/lib, it is a much better idea to use app/_ui app/_lib or just move those directories outside app