我正在尝试使用Visual Studio 2015在一个项目上设置React。作为一个初学者,我是有关YouTube here的教程。在创建ReactDOM.render
的{{1}}时,我发现自己如下:
app.js
他无法识别React语法(我不确定为什么)。
经过调查,我认为它可能来自import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(<h1>Hello, world!</h1>, document.getElementById("root"));
文件,而该文件可能在babel-preset-react
文件中被错误地调用。
请问有人可以帮我澄清一下这个问题吗?
以下是您可能会感兴趣的不同文件:
package.json
webpack.config.js
webpack.config.js
{
"name": "tuturial",
"version": "1.0.0",
"description": "User1 & ASP.Net tutorial",
"main": "apps.js",
"scripts": {
"webpack": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "User1",
"license": "UNLICENSED",
"devDependencies": {
"babel-loader": "^8.0.5",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
}
}