3 ms·
Redux itself doesn't actually care how you organize your file structure (per the FAQ entry at https://redux.js.org/faq/code-structure https://redux.js.org/faq/c
by acemarke 8y ago
Redux itself doesn't actually care how you organize your file structure (per the FAQ entry at https://redux.js.org/faq/code-structure https://redux.js.org/faq/code-structure ).
For the size of the tutorials, it's probably simpler to use a "folder-by-type" structure. But yes, for real apps, I myself have settled on a "folder-by-feature" structure. Note that either approach is completely orthogonal to whether you have multiple reducers listening to the same action.
The tutorial is already trying to explain a lot of concepts that are new to most people, so we try to keep it focused on the meaningful concepts. Throwing in side discussions on folder structures would probably add more confusion at that point in the learning curve.
- Izkata 8y agoSee, the part we disagree with seems to be here: > so we try to keep it focused on the meaningful concepts. For me, scattering a single feature across multiple directories makes it far harder to understand what relates to what. It's _less_ meaningful to group by type than by feature, which makes it harder to learn than it should be. I'm not saying the docs should go into asides about the alternative structures all over, but rather the people promoting Redux should definitely consider whether or not their examples smell more of spaghetti code than they need to be.
- acemarke 8y agoI don't currently have time to go revamp the docs and examples myself, but if you'd like to file a PR to rework things, we can definitely take a look at it.
- jwdunne 8y agoI agree. When you learn React, small examples typically follow folder-by-type but, in larger apps, it becomes apparent this doesn't work. If you take the recommended path, i.e add redux iff you need it, you've already settled away from folder-by-type. It's natural to organise by feature since you're generally doing it anyway by that point. Instead of a rework, it might be easier to add a small page on folder structure. Noticed you on Reactiflux too, hi!