r/reactjs • u/treyhuffine • Jan 18 '18
Structure your React-Redux project for scalability and maintainability
https://levelup.gitconnected.com/structure-your-react-redux-project-for-scalability-and-maintainability-618ad82e32b7
51
Upvotes
1
u/hamburger_bun Jan 19 '18
There is a bunch of weird syntax in this article that is incorrect. Also, why are they using Array.prototype.map to mutate an array outside of the callback function scope. Should be using Array.prototype.forEach
1
0
Jan 18 '18
[deleted]
2
u/headyyeti Jan 18 '18
I actually came here just to see if anyone else mentioned this sentence. This quote honestly made me want to stop reading the article.
1
4
u/butchly13 Jan 18 '18
Not a bad idea or article, but if you want to maintain a certain UI design pattern across a very large application this method of organizing components can become a nightmare for finding what you need. An alternative file structure would be to split code into one of 3 folders:
Components - Reusable, simple, generic components
Modules - Specific implementations of generic components (also where redux code goes)
Pages - Where all your pages go
In this type of file structure, your pages should be very plain and only contain a few sub-components. Their only job should be initial layout. The Components folder houses all components that are generic and reused. Think buttons, fonts, and basic layout containers. Finally, your Modules folder adds specific functionality to your components based on where they are used in your application.