Easier way to migrate observed React props to react-mobx 9? #4567
Replies: 1 comment
-
There seems to be 46 files using If you don't use these computeds (or this.props directly) in autorun/reaction, I think you can just remove the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
We're currently in the process to migrate our codebase from Mobx 5 & mobx-react 5 to Mobx 6 and mobx-react 9.
While that's a ton of work already, we are also running head-first into React props no longer being observable, and that's really killing us.
We have 210 React components powered by Mobx, and they all make heavy use of the pattern
@computed get isReady() { return this.props.isReady }
etc. to make props observable.It would be a lot of manual work to convert all of these into the alternative of manually updating these in
componentDidUpdate
calls.Can you think of any other ways to solve this that would be less cumbersome to us? Compatibility with
<StrictMode>
would be nice, but is not required for us right now.Would it be possible to write a custom monkeypatch or extension that enables observing props like before, for example?
PS: Our code is public over at https://github.com/owid/owid-grapher, so do take a look if that helps!
Beta Was this translation helpful? Give feedback.
All reactions