Hacker News new | ask | show | jobs
by lettersdigits 3404 days ago
My opinion and current way of working is:

* 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)

1 comments

Yep, we very clear and make a lot of sense. Would tend to agree with everything that you have said.