NextJS best practises
Answered
Cimarrón Uruguayo posted this in #help-forum
Cimarrón UruguayoOP
For app-router projects, is it okay to have directories under
app without any page.tsx when the folder name is not prefixed with a _?Answered by joulev
once again, my own opinion. i use
app for routing and things that are not reusable (components only used once in a single page, for example)19 Replies
Cimarrón UruguayoOP
for example
it works, but not a good practice imo
@joulev it works, but not a good practice imo
Cimarrón UruguayoOP
hmm then why is the sample project of nextjs like that?
the acme one
well it's not a good practice in my opinion, not necessarily the opinion of the author of acme
Cimarrón UruguayoOP
do you recommend renaming to
_ prefixyes
else you might accidentally put a
page.js or a route.js file in thereCimarrón UruguayoOP
ok thanks
no harm in
_, only benefits@joulev no harm in `_`, only benefits
Cimarrón UruguayoOP
benefits readability
but overall i just put it outside
app@joulev but overall i just put it outside `app`
Cimarrón UruguayoOP
benefit of src/ dir
then?
would be good idea to use that
@Cimarrón Uruguayo benefit of src/ dir
yes
src/
app/
lib/
etconce again, my own opinion. i use
app for routing and things that are not reusable (components only used once in a single page, for example)Answer
for things that are reusable (imported to several different places), i put them outside
appCimarrón UruguayoOP
thank you