Next.js Discord

Discord Forum

Where is best to create a /components folder to store components?

Answered
Florida White posted this in #help-forum
Open in Discord
Avatar
Florida WhiteOP
Hi there, I want to create a folder to store inside components like NavBar, Footer, etc, but I believe that creating that folder inside the /app folder will not be the best option as we only create folder-based routes inside the app folder. So, where is it recommended to create it?

Thanks in advance!
Answered by B33fb0n3
Yea, I think the best you can do is to seperate the components that you only need for a specific part, to their specific route. If you need to reuse specific components, just move the up the tree
View full answer

9 Replies

Avatar
Yea, I think the best you can do is to seperate the components that you only need for a specific part, to their specific route. If you need to reuse specific components, just move the up the tree
Answer
Avatar
Florida WhiteOP
outside the /app directory?
Avatar
no, inside your app directory
Avatar
@Florida White for me, i usually go with the src directory option.
(they ask if you want to use /src in create next app)
global components go inside a components folder in src. Local components are still collocated where they need inside app
Avatar
thanks for confirming the stragegy 👍
Avatar
Top tier stragegy
Avatar
Florida WhiteOP
Yes, this is how i I currently work with it: src/components, but if i were adding the components inside the app folder, this would not normally be turned into a /components route?
Avatar
no it won't. It will only be routable, when you add a page.tsx there as well. Else not
Avatar
@Florida White solved?