NextJS naming convention
Answered
Amorph posted this in #help-forum
AmorphOP
when there are various DB queries that will be used many times across the database, in order to make them reusable, you will create separate files for each of them, and all those files will be inside a folder, but i can't think of a good suggestive name.
i thought of data or hooks folder name but i feel like it's not that suggestive or even correct, does the next.js team come with naming conventions related to this or does anyone else have better naming ideas?
i thought of data or hooks folder name but i feel like it's not that suggestive or even correct, does the next.js team come with naming conventions related to this or does anyone else have better naming ideas?
Answered by joulev
no there are no naming conventions that are officially recommended/endorsed. i just make
lib/db/queries.ts or something similar, if you have many of them then lib/db/user.ts, lib/db/products.ts, etc. no need to stress yourself too much about something as simple and easy-to-change as file names2 Replies
@Amorph when there are various DB queries that will be used many times across the database, in order to make them reusable, you will create separate files for each of them, and all those files will be inside a folder, but i can't think of a good suggestive name.
i thought of data or hooks folder name but i feel like it's not that suggestive or even correct, does the next.js team come with naming conventions related to this or does anyone else have better naming ideas?
no there are no naming conventions that are officially recommended/endorsed. i just make
lib/db/queries.ts or something similar, if you have many of them then lib/db/user.ts, lib/db/products.ts, etc. no need to stress yourself too much about something as simple and easy-to-change as file namesAnswer
@joulev no there are no naming conventions that are officially recommended/endorsed. i just make `lib/db/queries.ts` or something similar, if you have many of them then `lib/db/user.ts`, `lib/db/products.ts`, etc. no need to stress yourself too much about something as simple and easy-to-change as file names
AmorphOP
oh, i see, thank you
now that u mentioned u create a queries.ts or similar u just made me think that a folder named queries might actually be best thing i didnt think of 😄
now that u mentioned u create a queries.ts or similar u just made me think that a folder named queries might actually be best thing i didnt think of 😄