小编典典

在反应应用程序中收到“尝试导入错误:”

all

尝试运行我的 React 应用程序时收到以下错误:

./src/components/App/App.js
尝试导入错误:“combineReducers”
未从“../../store/reducers/”导出。

这是我导出的方式combineReducers

import { combineReducers } from 'redux';
import userReducers from './userReducers';
import articleReducers from './articleReducers';

export default combineReducers({
    userReducers,
    articleReducers
});

这就是我将其导入的方式App.js

import { combineReducers } from '../../store/reducers';

我的导出方式有什么不正确的combineReducers


阅读 52

收藏
2022-08-05

共1个答案

小编典典

import { combineReducers } from ‘../../store/reducers’;

应该

import combineReducers from '../../store/reducers';

因为它是默认导出,而不是命名导出。

这里对两者之间的差异进行了很好的细分。

2022-08-05