-
Notifications
You must be signed in to change notification settings - Fork 88
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
return void draft.count++ in TS #37
Comments
Ah, it's actually in README. Looks like a typo to me, should be without that Either way, with Immer you don't need to be returning anything, just mutate values and done. The |
"Doesn't seem to work" is unactionable. Please include actual relevant
information/ reproduction / example rather than making us _guess_ what
might be wrong.
There is no code / error shared at all. Filing issues this way is typically
will get them closed without resolution.
Op do 31 okt. 2019 06:34 schreef Daniel K. <notifications@github.com>:
… Huh, I've never seen return void draft.count++ before :D Surprisingly
enough, it's syntactically correct.
Either way, with Immer you don't need to be returning anything, just
mutate values and done.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#37?email_source=notifications&email_token=AAN4NBDSC34JRRD5INRXSADQRJ37BA5CNFSM4JHBPX7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECWWOVI#issuecomment-548235093>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBAJPKR5PLRTWH3NKXLQRJ37BANCNFSM4JHBPX7A>
.
|
@mweststrate you're right, my bad. Like @FredyC suggested, not returning anything in the reducer function is fine. I didn't know that. FWIW: return void state.isOpen = true; TS will underline If anyone wants to still use void, you can do: return void (state.isOpen = true); But again, this works perfectly fine too: state.isOpen = true;
return; |
It would be good to update the readme to explain this. |
When using
useImmerReducer
, I havereturn void draft.count++
but it doesn't seem to work. I'm quite new to bothimmer
and TypeScript. If anyone knows what's going on, I'd really appreciate your help.Thank you.
The text was updated successfully, but these errors were encountered: