尝试运行我的 React 应用程序时收到以下错误:
./src/components/App/App.js 尝试导入错误:“combineReducers” 未从“../../store/reducers/”导出。
这是我导出的方式combineReducers:
combineReducers
import { combineReducers } from 'redux'; import userReducers from './userReducers'; import articleReducers from './articleReducers'; export default combineReducers({ userReducers, articleReducers });
这就是我将其导入的方式App.js:
App.js
import { combineReducers } from '../../store/reducers';
我的导出方式有什么不正确的combineReducers?
import { combineReducers } from ‘../../store/reducers’;
应该
import combineReducers from '../../store/reducers';
因为它是默认导出,而不是命名导出。
这里对两者之间的差异进行了很好的细分。