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

shall we setState like native hook? #22

Closed
piggyman007 opened this issue Aug 16, 2019 · 3 comments
Closed

shall we setState like native hook? #22

piggyman007 opened this issue Aug 16, 2019 · 3 comments

Comments

@piggyman007
Copy link
Contributor

shall we setState like native hook?

e.g., setData(newData) instead of

setData(v => newData)

@dai-shi
Copy link
Owner

dai-shi commented Aug 16, 2019

Yes, both are possible.

<button type="button" onClick={() => update(value + 1)}>+1</button>

<button type="button" onClick={() => update(v => v + 1)}>+1</button>

@piggyman007
Copy link
Contributor Author

Thanks for the response.
I have added more example in the readme file, please merge my PR.
@dai-shi

@dai-shi
Copy link
Owner

dai-shi commented Aug 17, 2019

Merged. Thanks. Look forward to more feedbacks.

@dai-shi dai-shi closed this as completed Aug 17, 2019
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