Support for the experimental syntax \'optionalChaining\' isn\'t currently enabled
I was getting the above error. I followed this post and
package.json
{
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"customize-cra": "^0.4.1",
"react-app-rewired": "^2.1.3"
}
...other
}
config-overrides.js
const { useBabelRc, override } = require('customize-cra');
module.exports = override(useBabelRc());
.babelrc
{
"plugins": ["@babel/plugin-proposal-optional-chaining"]
}
detailed blogpost