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

Documentation: More examples beyond Todo would be great #55

Closed
desmap opened this issue Jan 25, 2019 · 2 comments
Closed

Documentation: More examples beyond Todo would be great #55

desmap opened this issue Jan 25, 2019 · 2 comments

Comments

@desmap
Copy link

desmap commented Jan 25, 2019

I looked only briefly into easy-peasy and I guess I missed some stuff: I did a counter example https://codesandbox.io/s/mjojvp28wp and couldn't get to change the count with onClick, it's disappearing. Guess I need to use specific mutation methods from Immer? Or how does this work?

@ctrlplusb
Copy link
Owner

You were very close. You have to mutate the state, or return back the whole of the mutated state.

I've updated it here:
https://codesandbox.io/s/4348xxxkqw

I've added a commented out version showing how you can mutate the state by returning a new instance of it. 👍

@desmap
Copy link
Author

desmap commented Jan 25, 2019

@ctrlplusb, thanks for your super quick reply and this makes sense

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