以下是我的教程:Reactjs示例
当我运行教程中所写的"npm“时,会弹出一个窗口,并收到以下错误消息:
./src/index.js试图导入错误:'./App‘不包含默认导出(导入为'App')。
我的index.jsis给出如下:
我的index.js如下所示:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { Drizzle } from "@drizzle/store";
import MyStringStore from "./contracts/MyStringStore.json";
/*ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
*/
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
//reportWebVitals();
// import drizzle functions and contract artifact
// let drizzle know what contracts we want and how to access our test blockchain
const options = {
contracts: [MyStringStore],
web3: {
fallback: {
type: "ws",
url: "ws://127.0.0.1:9545",
},
},
};
// setup drizzle
const drizzle = new Drizzle(options);
ReactDOM.render(<App drizzle={drizzle} />, document.getElementById('root'));
//NOTE index.js should be the same as given after the line:
//Once that is complete, your index.js should look something like this:
//at: https://www.trufflesuite.com/guides/getting-started-with-drizzle-and-react谁来指点我。
祖尔菲
发布于 2021-08-06 09:10:03
确保您的App.js文件包括export default App;作为最后一行。
https://ethereum.stackexchange.com/questions/106677
复制相似问题