Skip to content Skip to sidebar Skip to footer

React Native Jest SyntaxError: Duplicate __self Prop Found

Still haven't gotten a successful run of this to pass with a fairly boilerplate Expo app built with create-react-native-app-- strangely, this passed once, and then failed after I r

Solution 1:

TLDR; I followed the steps to upgrade to React 17 and switch to @babel/preset-react as in the official React blog Introducing the New JSX Transform

Added to package.json:

  "@babel/preset-react": "^7.12.10",

Upgraded in package.json:

  "react": "17.0.1",
  "react-dom": "17.0.1",

Modified babel.config.cjs:

module.exports = function (api) {
    api.cache(true);
    return {
        "presets": [
            ["@babel/preset-react", {
                "runtime": "automatic"
            }]
        ]
    };
};

Post a Comment for "React Native Jest SyntaxError: Duplicate __self Prop Found"