Component-based React-Redux project directory structure

I know there are a few questions about the response-redux project code structure, but I hope to discuss a different approach. Therefore, the main libraries that we are going to use are: webpack - react - redux -mocha - karma.

The classic folder structure for this is as follows:

js
β”œβ”€β”€ actions
β”‚   β”œβ”€β”€ action-for-componentA.js
β”œβ”€β”€ components
β”‚   β”œβ”€β”€ componentA.js
β”œβ”€β”€ reducers
β”‚   β”œβ”€β”€ reducer-for-componentA.js
└── stores ...

This is similar to what everyone else and all generators do. But I feel that this is not a reactive way of structuring a project. The focus should be on the component, not the individual reaction or contraction constructs. I would like to think about it this way when you need to change the button in PageX that is contained in the component hierarchy that starts with ComponentX -> ChildOfX - I should be able to move directories the same way.

Instead of having a components folder with all the components thrown inside it, I would like to have something like:

js
β”œβ”€β”€ PageX
β”‚   β”œβ”€β”€ action-for-pagex.js
    β”œβ”€β”€ componentX.js
    β”œβ”€β”€ containerX.js
    β”œβ”€β”€ reducerX.js
    β”œβ”€β”€ children
        β”œβ”€β”€ childrenC
        β”œβ”€β”€ childrenB 
            β”œβ”€β”€ componentB.js
            β”œβ”€β”€ reducerB.js
            β”œβ”€β”€ ...
β”œβ”€β”€ PageY
β”‚   β”œβ”€β”€ ...
β”œβ”€β”€ PAgeZ
β”‚   β”œβ”€β”€ ...

It will be easier to go through, and it makes sense when you think you are β€œreacting”. Can anyone see anything that might go wrong with this approach?

: http://engineering.kapost.com/2016/01/organizing-large-react-applications/

+4
2

TL; DR ; .

- React Redux. , R & R stack. , .

, , , . " ", " ".

React/Redux , .

, :

  • pages.
  • .
  • component.js
  • , , shared
  • , . , .
  • , (app.js).
  • ES6, .

:

constants
  -- const.js
  -- const2.js
helpers
  --helperfunc1.js
shared
  --Shared Element1
    --- component.js
    --- reducer.js
  --Shared Element2
    --- component.js
    --- reducer.js
specs
  -- spec1.js
  -- spec2.js
pages
 -Page1
 -- Subpage1
   --- component.js
   --- reducer.js
   -- Subpage2
     --- component.js
     --- reducer.js
  -- component.js
 -- reducer.js
 -Page2
 -- component.js
 -- reducer.js
 ...
container.js
app.js
reducer.js

, , :  - .  - .  - ,  - .  - .  - , TableDataComponent.js , table/component.js.  - React , . . - .

Reddit thread , .

+1

, Folder structure

+1

All Articles