Javascript React JS尝试导入错误:'/探路者/探路者';不包含默认导出(作为';Pathfinder';导入)
我已经看了很多不同的修复方法,但是我不能。当我编译react代码时,我得到一个错误,说我需要使用默认的导出,即使我是通过类导出的。我试着只导出调用pathfinder脚本的部分,但这不起作用Javascript React JS尝试导入错误:'/探路者/探路者';不包含默认导出(作为';Pathfinder';导入),javascript,reactjs,Javascript,Reactjs,我已经看了很多不同的修复方法,但是我不能。当我编译react代码时,我得到一个错误,说我需要使用默认的导出,即使我是通过类导出的。我试着只导出调用pathfinder脚本的部分,但这不起作用 import React from 'react'; import './App.css'; import Pathfinder from './Pathfinder/Pathfinder'; function App() { return( <div className="A
import React from 'react';
import './App.css';
import Pathfinder from './Pathfinder/Pathfinder';
function App() {
return(
<div className="App">
<Pathfinder></Pathfinder>
</div>
);
}
export default App;
从“React”导入React;
导入“/App.css”;
从“./Pathfinder/Pathfinder”导入Pathfinder;
函数App(){
返回(
);
}
导出默认应用程序;
Pathfinder.js
import React, {Component} from 'react';
import Node from './Node/Node';
import './Pathfinder.css';
function app(){
return(
<div>
<p>
</p>
</div>
);
}
import React,{Component}来自'React';
从“./Node/Node”导入节点;
导入“/Pathfinder.css”;
函数app(){
返回(
);
}
这里有很多值得怀疑的事情,特别是你有一个应用程序组件和一个应用程序组件。但是,由于您的错误正在传播,您没有在Pathfinder.js中导出应用程序组件。脏补丁:
export default function app() {
// ...
}
不过,至少,我会将函数重命名为Pathfinder
请在中使用Pathfinder
导出更新您的问题。Pathfinder/Pathfinder.js
。您的Pathfinder.js
根本没有任何导出,但您需要添加类似于导出默认应用程序的内容代码>