reactjsreact-hooksmobxmobx-react

Is mobx(5*) + mobx-react (6*) versions are compatable for react 18 version


From mobx-react official doc resource as a guide. We concluded that mobx(5*) + mobx-react (6*) versions are compatible for react 18 version. But after updating our repo we got some issues related to React 18: observer not working with React Class components <React.StrictMode>

Our Versions

"mobx": "5.15.0",
"mobx-react": "6.1.4",
"react": "18.2.0",
  

Are mobx(5*) and mobx-react(6*) versions compatible with react 18? If not, What are the compatible versions of mobx and mobx-react that can be used when using React 18?


Solution

  • We concluded that mobx(5*) + mobx-react (6*) versions are compatible for react 18 version.

    How you made this conclusion? It clearly says that mobx-react v6 only supports >16.8 <18 React, and <18 means that React version 18 is not supported.

    NPM Version Support MobX version Supported React versions Supports hook based components
    v7 6.* >16.8 Yes
    v6 4.* / 5.* >16.8 <18 Yes
    v5 4.* / 5.* >0.13 <18 No, but it is possible to use <Observer> sections inside hook based components

    So your only option is mobx-react@7 and mobx@6.

    EDIT: Oh, I see that matrix was just updated because you also asked this question on Github Discussions, and before it stated different information, so it's not your fault at all, sorry.