DEV Community

Discussion on: How I structure my React projects

Collapse
 
ebnibrahem profile image
ebnibrahem

thanks for sharing.. Next.

what's best?

  • home > components > headerComp.js
  • profile > components > accountComp.js each page has child folder named components.

OR

  • components>home>headerComp.js
  • components>profile >accountComp.js

One folder named components contains all app components.

Collapse
 
lesleyvdp profile image
Lesley van der Pol

I personally think it is always good to try and have a good separation of concerns. I think you are talking about page specific components? Those don't belong in the components folder, unless they are reusable by other pages. In this case I would personally opt towards having a components folder within your page folder itself.

Everything that is reusable however could and should go into the generic components folder.