Skip to content
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

Avoid constants usage and autogenerate actions & reducers from single source like Edux does #2199

Closed
dogada opened this issue Jan 12, 2017 · 3 comments

Comments

@dogada
Copy link

dogada commented Jan 12, 2017

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

It's need to add constant for each action name and define separately actions and reducers. In reducers you often need to use switches and each reducer should be able to handle all actions (to return state unchanged for an unknown actions). This leads to unnecessary boilerplate, code duplication and will slowdown reducer stage for complex states.

What is the expected behavior?

It's possible to define state changes once and generate from this single source of truth both actions and reducers fully compatible with current Redux ecosystem. For example of this approach you can see my attempt to improve this situation:

https://github.com/dogada/edux

For every action it has O(1) speed instead of Redux's O(N) where N is number of reducers.

@brigand
Copy link
Contributor

brigand commented Jan 12, 2017

This is something that should be solved in user space. If you like, send a pull request to markerikson/redux-ecosystem-links; specifically action-reducer-generators.

@markerikson
Copy link
Contributor

Agreed. This isn't actually a specific "feature" request, either, as it doesn't suggest any actual changes to Redux, but rather just points to an addon library.

@dogada
Copy link
Author

dogada commented Jan 12, 2017

Thanks. Sent a PR: markerikson/redux-ecosystem-links#35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants