DEV Community

Discussion on: How I structure my React projects

Collapse
 
vhs profile image
vhs

Worth mentioning are import aliases, barrels and co-location. Aliases work together with barrels to make it easy to logically organize a project regardless of its physical structure. And co-location of files based around features tend to help eliminate the urge to create esoteric folders names. Here's a repo I recently stumbled upon which inspired me to change the way I structure my own projects. Perhaps it will inspire some of you as well.

Collapse
 
jeffreythecoder profile image
Jeffrey Yu

Useful advice! Colocation is used in /components under each page to keep modules of the same page together. For aliases and barrels, I would set folder names in components clearly so I can directly import with physical path. Nevertheless, they are definitely useful as files in components scales.