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

Violating Redux Principles #1

Closed
ghost opened this issue Jan 10, 2017 · 2 comments
Closed

Violating Redux Principles #1

ghost opened this issue Jan 10, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 10, 2017

It looks like you're violating at least two Redux principles. Firstly you don't have a single source of truth. The DataTable class owns a state while there is also state in the store. Secondly you are using setState(). Instead of setState(), simply dispatch an action. Maybe you didn't catch these issues because you didn't originally start with Redux from the beginning of the project.

@jakeowns
Copy link
Owner

The state of the input fields in the DataTable component were not meant to be shared in a global context, therefore it was kept in local state. Refer to the following issue discussing when to use Redux store or React state.
reduxjs/redux#1287 (comment)

@ghost
Copy link
Author

ghost commented Jan 10, 2017

I understand there are some use cases for a "local" state and Redux in the same app. I'm curious as to why you think you need a "local" state though.

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

1 participant