[英]./src/index.js Attempted import error: './App.js' does not contain a default export (imported as 'App')
Below is the index.js code.下面是 index.js 代码。 Below error ./src/index.js Attempted import error: './App.js' does not contain a default export (imported as 'App') How to solve this?
下面的错误 ./src/index.js Attempted import error: './App.js' does not contain a default export (imported as 'App') 如何解决这个问题?
I guess your code was like this,since I cant see your code I am attaching mine.See at the bottom line of the code,add that export default app line in your code as mentioned,You'll good to go then I believe.我猜你的代码是这样的,因为我看不到你的代码,所以我附上了我的代码。在代码的最后一行,如上所述,在你的代码中添加导出默认应用程序行,然后我相信你会很高兴的。
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>Edit <code>src/App.js</code> and save to reload.</p>
<a className="App-link"href="https://reactjs.org"target="_blank"rel="noopener noreferrer" >
Learn React
</a>
</header>
</div>
);
}
export default App;
在“App.js”文件的底部,添加以下行:
export default App;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.