'React Native - TypeError: n.createContext is not a function. (In 'n.createContext(o.default)', 'n.createContext' is undefined)
I'm trying to implement React Native into an existing Android application. I follow the steps in the official documentation and I have ended with the following error when I compile the app (Although I receive an error the build is successful).
On my phone:
In Android Studio emulator:
Has someone faced the same issue?
Is the official React Native docs wrong?
Solution 1:[1]
Unless you are using the React context API yourself, this is likely to be related to a mismatch between your React version and the version of some other dependency like react-dom
Please check in your package.json if react-dom and react versions match.
You can upgrade the react version to solve the problem
yarn upgrade react react-dom
Also see these similar questions:
"React.createContext is not a function" - but I am not using it
_react.default.createContext is not a function when using react-redux
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stefan Blamberg |