immerjs / use-immer

Use immer to drive state with a React hooks
MIT License
4.04k stars 92 forks source link

Destructuring `draft: WritableDraft<T>` argument results in state not being updated #95

Closed edag94 closed 2 years ago

edag94 commented 3 years ago

I'm pretty sure this is by design, can I add this to a short troubleshooting section in Readme, so others don't run into this issue?

EDIT: After reading this: https://hackernoon.com/introducing-immer-immutability-the-easy-way-9d73d8f71cb3 and briefly browsing the code, I believe destructuring doesn't work because you are no longer interacting with the Proxy object.