Javascript 模块分析失败:意外令牌(4:16)
我不熟悉前端开发。我似乎得到了这个错误:Javascript 模块分析失败:意外令牌(4:16),javascript,reactjs,webpack,babeljs,Javascript,Reactjs,Webpack,Babeljs,我不熟悉前端开发。我似乎得到了这个错误: ERROR in ./js/index.jsx 4:16 Module parse failed: Unexpected token (4:16) You may need an appropriate loader to handle this file type, currently, no loaders are configured to process this file. See https://webpack.js.org/concepts
ERROR in ./js/index.jsx 4:16
Module parse failed: Unexpected token (4:16)
You may need an appropriate loader to handle this file type, currently, no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import ReactDOM from "react-dom";
| import App from "./App";
代码如下:
ReactDOM.render(<App />, document.getElementById("content"));
ReactDOM.render(,document.getElementById(“content”);
提前感谢正如评论中的大多数人已经指出的那样,函数的第一个参数不能为空,因为它不是可选的。以下是代码的外观:
ReactDOM.render(App, document.getElementById("content"));
编辑:
不是如何在呈现函数中应用应用程序组件,您只需像上面的示例一样使用应用程序变量。ReactDOM.render(,document.getElementById(“content”)代码>将不起作用。如果没有1,你不可能有第二个论点。我正在关注这段视频。我可以知道如何修改它吗?如果一个视频教程告诉你在编写JavaScript的同时忽略了初始参数,你可能希望找到一个不同的(希望更准确的)初始参数-初始参数不是可选的。您可能想在那里放置一个React组件