Finding is better than folding

Jan 12, 2021

I was reading this thread on Reddit about how to structure your React files. In the past I would have said something like:

1components/ 2 layout/ 3 component_name 4 data/ 5 component_name 6 other_domain/ 7 component_name 8 ...

and used an index.js in every folder for the root React component. These days I’m much more inclined to do:

1components/ 2 component_name

because I find both deeply nested folders and files with the same name annoying. I also think it’s ideal if you can quickly move through files with linked structures (F12 in VS Code if you’re using Typescript) or search for files using the Command Palette rather than trying to guess from / down where a file might be.

Posted: January 2021