简体   繁体   English

在反应应用程序中尝试导入错误,但路径和一切都是正确的

[英]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.

相关问题 尝试导入错误,无法编译反应应用程序 - Attempted import error, failed to compile react app 如何修复我的 React 应用程序中尝试导入的错误? - How can I fix attempted import error in my React App? 尝试导入错误:“App”未从“./App”导出 - Attempted import error: 'App' is not exported from './App' 如何修复“尝试导入错误 React”? - How to fix "attempted import error React"? ./src/App.jsx 尝试导入错误:“路由”未从“react-router-dom”导出 - ./src/App.jsx Attempted import error: 'Routes' is not exported from 'react-router-dom' 我在将找到的现有 React 组件集成到我的应用程序中时遇到问题。 “尝试导入错误:” - I am having an issue with integrating an existing react component I found, into my app. "Attempted import error:" 反应尝试导入 - React Attempted import 反应错误“尝试导入错误:'TodoItem'未从'./Todoitem'导出。” - error in react " Attempted import error: 'TodoItem' is not exported from './Todoitem'. " 尝试导入错误:“getMoviesList”未从“./actions”导出; 反应错误 redux - Attempted import error: 'getMoviesList' is not exported from './actions'; error in react redux 尝试导入错误:“app”未从“firebase/app”导出(导入为“firebase”) - Attempted import error: 'app' is not exported from 'firebase/app' (imported as 'firebase')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM