Next.js: Why You Shouldn't Use a Global /components Folder for Everything
Exploring a common mistake when structuring a Next.js project with the app router and explaining what you should actually be doing to ensure your project is clean.
Listen to article0:00 / 0:00
- One crucial mistake I made when working on my first Next.js project was to place all my components in a root
/componentsfolder. - This wasn't a problem for a while, because I didn't have many components at the start so the structure of my project was quite clear and easy to understand.
- However, as my project grew, I just kept adding more and more components to the same root
/componentsfolder and I started to get a nagging sense that it wasn't the most effective way of structuring a project. - Nothing was organised properly, so I would spend ages scrolling and sifting through components that weren't at all related to the problem I was trying to solve, just to find what I needed.
Comments (0)