Reputation: 1502
The project was created with create-react-native-app.
When I use code like const a = 2 ?? 3
, there will be an error complaining "Cannot read property 'loose' of undefined".
I tried adding the @babel/plugin-proposal-nullish-coalescing-operator plugin, but there's a build error.
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
},
"plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"]
}
Upvotes: 2
Views: 5564
Reputation: 1731
This might be a problem with your babel version:
Make sure that you've installed all the correct babel 7 dependencies, e.g.:
@babel/core instead of babel-core
@babel/cli instead of babel-cli
@babel/preset-env instead of babel-preset-env
https://www.menubar.io/cannot-read-property-loose-of-undefined/
Upvotes: 2