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

Does this work with another setState? #2

Closed
aocenas opened this issue Nov 17, 2018 · 3 comments
Closed

Does this work with another setState? #2

aocenas opened this issue Nov 17, 2018 · 3 comments

Comments

@aocenas
Copy link

aocenas commented Nov 17, 2018

I did not actually try the code, just looked at the source and this https://github.com/dai-shi/react-hooks-easy-redux/blob/master/src/index.js#L50 part seems like it would prevent any updates that were not triggered by the redux change. Like if I had also local useState which would change, this code would just prevent any updates until also the redux store changed. Is that correct or is there some part I do not get about this approach?

@dai-shi
Copy link
Owner

dai-shi commented Nov 17, 2018

The argument of useReduxState can be used for it.
I just created another example.
https://github.com/dai-shi/react-hooks-easy-redux/blob/master/examples/05_localstate/Counter.tsx#L11

I know it's tricky. I wish we would have a better solution.

@aocenas
Copy link
Author

aocenas commented Nov 18, 2018

Ah right, missed that, thanks for explanation.

@aocenas aocenas closed this as completed Nov 18, 2018
@dai-shi
Copy link
Owner

dai-shi commented Nov 18, 2018

Not at all. Thanks for pointing out. I think the document should be more improved.

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

2 participants