Where is best to create a /components folder to store components?
Answered
Florida White posted this in #help-forum
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!
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
9 Replies
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
Florida WhiteOP
outside the /app directory?
no, inside your app directory
@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
(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
thanks for confirming the stragegy 👍
Top tier stragegy
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?
no it won't. It will only be routable, when you add a
page.tsx
there as well. Else not@Florida White solved?