-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Folder structure, modules/ducks, best practices #169
Comments
I like this a lot. Especially the use of a water-based weapon to kill ducks. You are probably right, that "ducks" should be only a slang term to refer to the modular tuples. Sure, go ahead and submit a PR. Yes, both of those additional PRs would be great! Thanks for putting so much thought and effort into this. 👍 |
i like this too, i'd been structuring my folder structure similarly in my fork |
Hi @justingreenberg and @erikras, At the risk of sounding rather naive about some Webpack or ES6 (or other?) things, I have a question about how your path-less import statements work. @justingreenberg, in his original post above, mentioned that (italics added are mine)
This seems to have been implemented in this repo in places like Is that all that is needed to enable the path-less import mentioned in the code comments? Or do you also need to set something up an alias or something in the Webpack config? Perhaps Webpack's I see that you do specify Is it the combination of what you did in places like |
@jasonkylefrank yes, but the recommended method of resolving project paths is to use see: |
@justingreenberg Great, thanks for the info! |
…y as DUCKS but a more classical naming for easy transition). Based on: - react-redux-universal-hot-example - Folder structure, modules/ducks, best practices: erikras/react-redux-universal-hot-example#169 - react-redux-starter-kit - Follow ducks-like architecture: dvdzkwsk/react-redux-starter-kit#248 - react-redux-starter-kit - refactor(redux): use ducks-like architecture: dvdzkwsk/react-redux-starter-kit#265 Removed state data filtering logic from controllers and placed it inside selectors using reselect library for redux. Adapted components logic to use selectors library.
Thank you so much for putting together this awesome project. As a fresh set of eyes, I have a bit of feedback. Maybe it's just me but I found the project's folder structure to be a little confusing....
Proposed folder structure:
This is overly simplified as I didn't want to put the entire file tree into this discussion, but hopefully you get the idea. Components are contained within folders, aggregated and exported from root for destructured imports (similar to material-ui components).
As you can see, the structure is pretty clean and self-documenting. The only downside is the additional folder nesting, but I think it's well worth it for the sake of maintainability. It may be a little contrived for an example project, but for those using this as a "starter" it will pay dividends down the road. I am setting up webpack aliases so make things easier and reduce some of the import boilerplate. The folder structure above is working in a branch on my local machine, let me know I'd be happy to submit a PR!
Modules/Ducks
I love the concept of encapsulating reducer tuples (plus selectors) into bundles. I know ducks is your project and I totally did not mean to torpedo the name with the proposed folder structure above! I really think "module" or "redux-module" encapsulates the idea in a coherent way that doesn't make newcomers feel like they have to learn even more (imo ducks kinda sounds like another framework or something that would require additional cognitive overhead, but really it's simply bundling reducer logic).
Please let me know if you would any separate PRs for the following, which are also done...
I will try to help write some some documentation when I have time.
Looking forward to your thoughts. Cheers!
The text was updated successfully, but these errors were encountered: