[英]Attempted import error in react app but the path and everything is correct
I am receiving the following error: Attempted import error: 'MyPropertiesForm' is not exported from '../../forms'.
我收到以下错误: Attempted import error: 'MyPropertiesForm' is not exported from '../../forms'.
and I cannot figure out why because everything is correct.我不知道为什么,因为一切都是正确的。
Here is how I import import { MyPropertiesForm } from '../../forms';
以下是我如何import { MyPropertiesForm } from '../../forms';
// this file is in E:\falala\src\containers\MyPropertiesPage\MyPropertiesPage.js // 这个文件在 E:\falala\src\containers\MyPropertiesPage\MyPropertiesPage.js
And here is how I export这就是我如何导出
const MyPropertiesForm = compose(injectIntl)(MyPropertiesFormComponent);
MyPropertiesForm.displayName = 'ContactDetailsForm';
export default MyPropertiesForm;
//this file is in E:\falala\src\forms\MyPropertiesForm\MyPropertiesForm.js //这个文件在 E:\falala\src\forms\MyPropertiesForm\MyPropertiesForm.js
Try尝试
import MyPropertiesForm from '../../forms/MyPropertiesForm/MyPropertiesForm';
Pay attention that the path you gave was only to the "form" folder but the export was actually in a file deep inside that folder.请注意,您提供的路径仅指向“表单”文件夹,但导出实际上位于该文件夹深处的文件中。
And also pay attention that when you import a default exported module so you don't write it inside {} but write it as is named.还要注意,当您导入默认导出模块时,不要将其写在 {} 中,而是按命名方式编写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.