I have a issue:
We don't have react-dom in a React Native project,but it will be required in mobx-react.
The application performs normally but can't pass the test.
> jest
FAIL __tests__/index.ios.js
● Test suite failed to run
Cannot find module 'react-dom' from 'index.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:169:17)
at webpackUniversalModuleDefinition (node_modules/mobx-react/index.js:3:63)
at Object.<anonymous> (node_modules/mobx-react/index.js:10:3)
PASS __tests__/index.android.js (6.962s)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 8.674s
Ran all test suites.
npm ERR! Test failed. See above for more details.
react-native-cliyarn add mobx mobx-reactimport { observer } from 'mobx-react' in index.ios.jsnpm testUsing import { observer } from 'mobx-react/native' should solve that
Feel free to reopen if that doesn't solve the issue.
@mweststrate Thank you very much. I found some similar issues in mobx-react and it worked for me.
It would be nice if using 'mobx-react/native' was included in the documentation.
Most helpful comment
Using
import { observer } from 'mobx-react/native'should solve that