DEV Community

Discussion on: A Better Way to Structure React Projects

Collapse
 
jakecarpenter profile image
Jake Carpenter • Edited

I think you would be surprised how much harder you make things on yourself by doing as you've described.

Colocation by feature makes things easier to find. I don't like to scour a pages folder then the components folder and finally some random place because that's where someone decided "business logic" goes to modify a single feature. I like to put them in the same place until it is proven that they don't belong together or are shared by many areas. Then they get moved into a shared location that is dictated by circumstance.

This enforces good refactoring approaches. This is the biggest reason I like to do it that way. There is no one good project structure or one good pattern that fits all purposes, only patterns that evolve as your project and needs do.

Collapse
 
kevinast profile image
Kevin Bridges • Edited

Take a peek at this article: Are you using features?

Collapse
 
thewritingdev profile image
Akash Joshi • Edited

This might make sense if you have direct control over the codebase, but I've experienced it first-hand that having an easily enforcable and readable convention (whatever it might be for you) is a good way of scaling a project across a team :)