DEV Community

Discussion on: React, Redux app folder structure

Collapse
 
w9jds profile image
Jeremy Shore • Edited

Honestly, I highly recommend the duck system. I originally did everything (selectors, reducer, actions, constants) into a single file.

However, as my application got more complex and my store and sagas started use actions from elsewhere, I kind of adopted a more split up approach. The events file is populated with your action constants (I use enums) and sagas is your root sagas combining all of your store sagas. I highly recommend using redux-actions and reselect as not only do they cleanup a lot of code and boilerplate they can help with performance.

store
|__ events.ts
|__ sagas.ts
|__ current
| |__ actions.ts
| |__ reducer.ts
| |__ sagas.ts
| |__ selectors.ts
|__ notifications
  |__ actions.ts
  |__ reducer.ts
  |__ selectors.ts
Enter fullscreen mode Exit fullscreen mode