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

TBD: Introduce redux for global state management #76

Open
lamngo255 opened this issue Nov 2, 2020 · 0 comments
Open

TBD: Introduce redux for global state management #76

lamngo255 opened this issue Nov 2, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lamngo255
Copy link
Member

Essentially, Oddx requires many high-frequency changes to the global state. In the current design, context api was used for this purpose, but its use cases are limited to prop-drilling scenarios, and we have to figure out re-rendering issues every time a property in the context changes.

Perhaps it's better to use redux because it's best suited for global store management, with the usage of connect/useSelector/reselect to prevent re-rendering issues.

Conclusions:

  • High-frequency changes -> Redux FTW
  • Lower-frequency changes -> Context API + React.memo FTW
    E.g: Gameplay will be in Redux store, while theme, language, auth players will be handled by Context API.
@lamngo255 lamngo255 added enhancement New feature or request help wanted Extra attention is needed labels Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants