|
|
|
|
|
by simonfl3tcher
3404 days ago
|
|
Personally I have kept these separate before. I would just have /src/actions/{actionType}, but, that is not to say that these cannot be included in the components folder, and actually makes sense given that a certain action is generally associated with a certain component. What is your opinion? |
|
* if the reducers/actions/action creators/action types/sagas are UNIQUE to the component and are not being used elsewhere then it should sit together in the same folder .
* if they are more generic/being used in more than one place then I would put them all in a separate folder, since all of those parts are actually doing more or less one thing - manage a specific sub-section of your app's state.
This sub-section of your app's state can then be shared by many more than one entry point, which is extremely useful for me.
A REAL example:
I took the redux-login-saga-flow (https://github.com/sotojuan/saga-login-flow/tree/master/app), changed the folder structure so now i can just import the login state management into every entry point i want, and bam - it just works, since all of that state sits under 'login'.
I can now create a new webpage and add all of the login complexity in only a few minutes of work .
I Hope I was clear
(edit: some cleanup and spacing)