Skip to content

Make sure the starters and examples use a better redux folder naming strategy #214

Open

Description

@SethDavenport

Learnings from a recent large react project:

I actually really wish we'd broken the app down by feature area instead of by type of construct. But that ship has sailed at this point.

In future, instead of

  • sagas
  • selectors
  • reducers
  • containers
  • components
  • store

I would probably next time do something like:

  • pages
    • routes.js
    • checkout
      • checkout.container.js
      • checkout.selectors.js
      • checkout.actions.js
      • checkout.sagas.js (or effects/epics)
      • components
        • [checkout-specific dumb components]
    • ... (some other page)
  • common - for stuff shared across multiple pages
    • selectors - shared selectors
    • sagas (or effects, or epics) - common sagas/effects/epics like request-sequence
    • components
      • [shared dumb components - when you use it in more than one page, move it here]
  • store
    • configure-store.js
    • reducers
      • // all the reducers
  • app
    • app.container.js

Activity

  1. SethDavenport commented on Dec 23, 2016

    @SethDavenport
    ContributorAuthor

    This can apply to all flavours of project: Angular/ng2-redux, Angular/ngrx, AngularJS/Redux, React/Redux.

    This structure is much easier to grok when the codebase is large. @e-schultz @bennett000 @seanmay @egervari @smithad15 This has all come up with each of you independently, I think it's time to make sure that the starters are configured to follow this by default.

    @smithad15 you've played with codelyzer most recently - can we make such a structure play nice with the official angular style guide?

  2. SethDavenport commented on Dec 23, 2016

    @SethDavenport
    ContributorAuthor

    If so, we should get it into the starters and the example apps. Order of priority:

    ASAP:

    • angular2-starter
    • react-starter

    Medium-SAP: 😃

    • angular2-redux-example
    • react-redux-example
    • typescript-redux-example

    Low-SAP:

    • angular-starter (the ng1 one)
    • angular-redux-example (doesn't exist yet, still needs to be split from the ng1 starter)
  3. smithad15 commented on Dec 24, 2016

    @smithad15
    Contributor

    For angular, we will need to make some style guide specific tweaks when it comes to the pages folder as that would be substituted for the feature folder paradigm from the style guide (also has some router based lazy loading implications). I've been wanting to do a refactor of angular2-redux-example to follow this for awhile now but keep getting swamped with client projects. I had white-boarded a more angular-centric outline of this at one point. I can clean that up a bit and share it if desired.

    The angular2-starter should already support this structure since we decided to strip almost everything out of it, including anything redux related. For angular 2 I would say that getting the example changed would be more useful.

  4. SethDavenport commented on Dec 24, 2016

    @SethDavenport
    ContributorAuthor

    makes sense. I'm not too worried about the particular folder names - features makes sense as well. just want to move to more of a feature - based approach, but without coupling the store

  5. smithad15 commented on Jan 13, 2017

    @smithad15
    Contributor

    For consideration: https://github.com/smithad15/angular2-folder-structure-example

    I realise that there are parts of the store inside of each feature folder, however, I still think that there are parts of the application state that are tied to each feature area and should live there until they are used outside of that feature. At that point then of course they need to be promoted up to something more global.

  6. SethDavenport commented on Jan 13, 2017

    @SethDavenport
    ContributorAuthor
  7. SethDavenport commented on Jan 27, 2017

    @SethDavenport
    ContributorAuthor

    @egervari @clbond did either of you make any headway on this

  8. smithad15 commented on Feb 27, 2017

    @smithad15
    Contributor

    This still hasn't been completed in angular2-starter-example

  9. SethDavenport commented on Feb 27, 2017

    @SethDavenport
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions