I've been in the situation many times where I start a new React project with a clean folder structure, but after a few weeks, it turns into chaos. It seems like nothing ever feels quite right as the project grows. I'm curious about how everyone else structures their React projects these days. What strategies do you use to keep things organized?
3 Answers
I try to keep things close together by having a 'pages/' folder with subfolders for each page, plus a 'components/' folder for reusable stuff. Hooks get their own 'hooks/' folder too. It helps me stay organized and only pull things up when they’re used in multiple places.
It’s totally normal for your structure to get messy. I usually start with a feature-based approach, where I keep everything related to a specific feature in its own folder. But as components and views get reused, I find I need to move them into shared folders, like 'components/' and 'hooks/'. It seems to evolve naturally as the app grows.
Exactly! There’s no perfect solution. I think it’s all about keeping things localized at first and only abstracting them as needed.
Sometimes it feels overwhelming, right? But really, starting feature-based and gradually moving components as they get reused is a natural way to handle it. You'll end up with a structure that just makes sense for your app.

That’s a solid strategy! Have you ever found it tough to decide when to move something to shared? Seems like that can be tricky.