Closed Chr15t0pher closed 3 years ago
Since mobx6 you have to call makeObservable(this)
in the store's constructor:
https://mobx.js.org/migrating-from-4-or-5.html#upgrading-classes-to-use-makeobservable
Since mobx6 you have to call
makeObservable(this)
in the store's constructor: https://mobx.js.org/migrating-from-4-or-5.html#upgrading-classes-to-use-makeobservable
I see, thanks a lot.
When I migrate to
mobx
v6 andmobx-react
v7, usinguseRef
to keep store instance doesn't work any more, check the code below.And I also try it in class component, it didn't work either.
But all these work below
mobx-react
v7, I have no idea how to solve this problem.Intended outcome
Click the button, the
num
increase and view re-render, reaction callback is invoked.Actual outcome
the
num
increase but view doesn't re-render, reaction callback isn't invoked.How to reproduce the issue
https://codesandbox.io/s/adoring-shirley-dr23s?file=/src/App.tsx
Versions
mobx 6.0.1 mobx-react 7.0.0