收到“尝试导入错误:"在反应应用程序中 [英] Receiving "Attempted import error:" in react app
本文介绍了收到“尝试导入错误:"在反应应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在尝试运行我的 React 应用程序时收到以下错误:
I am receiving the following error when trying to run my React app:
./src/components/App/App.js
尝试导入错误:'combineReducers'
不是从../../store/reducers/"导出的.
./src/components/App/App.js
Attempted import error: 'combineReducers'
is not exported from '../../store/reducers/'.
这是我导出 combineReducers
的方式:
Here's how I'm exporting combineReducers
:
import { combineReducers } from 'redux';
import userReducers from './userReducers';
import articleReducers from './articleReducers';
export default combineReducers({
userReducers,
articleReducers
});
这是我在 App.js
中导入它的方式:
and here's how I'm importing it in App.js
:
import { combineReducers } from '../../store/reducers';
我导出 combineReducers
的方式有什么错误?
What's incorrect in how I'm exporting combineReducers
?
推荐答案
import { combineReducers } from '../../store/reducers';
应该
import combineReducers from '../../store/reducers';
因为它是默认导出,而不是命名导出.
since it's a default export, and not a named export.
两者之间的差异有一个很好的细分这里.
There's a good breakdown of the differences between the two here.
这篇关于收到“尝试导入错误:"在反应应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文