Solution for create-react-app React is not defined error

After creating a project with create-react-app 

After running npm run eject to expose the configuration

Starting the project gives an error:

React is not defined



JSX runtime webpack configuration will be removed during eject

So you need to add the configuration back in package.json

// package.json 


 "babel": {
    "presets": [
      [
        "react-app",
        {
          "runtime": "automatic"
        }
      ]
    ]
  }



评论

暂无评论。

登录后可发表评论。