-
-
Notifications
You must be signed in to change notification settings - Fork 349
Using observer with react hooks does not work #594
Comments
Looking at the code (https://github.com/mobxjs/mobx-react/blob/master/src/observer.js#L321-L343) I get the feeling that observer is converting a function component to a class which will not work when using hooks? |
So I guess we will have to wait for #588 to be able to use hooks together with mobx. |
I have a working prototype now that fixes the error you are seeing (see #588). https://github.com/johot/mobx-react |
Closing in favor of #588. We won't be actively supporting a feature that is not actually released. |
The simple work around is to use |
@mweststrate I did not know about |
Please give me an example. |
See also mobx-react-lite package if you want to use hooks
Op vr 11 jan. 2019 09:03 schreef David Tran <[email protected]>:
… Please give me an example.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#594 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhHNOeFeSS8puz9EP709qcASgctpkks5vCEVggaJpZM4YD4Bm>
.
|
@davidtran |
You can now also use |
Hi guys. I did your tips but the problem is still yet. May someone help me to fix it? Thank you in advance and I appreciate your help. |
@ali-master please open a fresh issue, following the normal format with reproduction and such. |
Thank you, I will |
https://codesandbox.io/s/7z9yok8mn1
This error occurs:
There is already an issue for this (#591) but it was closed as the author wants to wait for a version of mobx-react that uses hooks itself.
Although I am also looking forward to that my intention is to try out hooks in my projects and start using them, even if mobx-react itself can not yet be switched.
This is not possible as observer causes the above error.
The text was updated successfully, but these errors were encountered: