gpt4 book ai didi

reactjs - 在React应用程序中接收 "Attempted import error:"

转载 作者:行者123 更新时间:2023-12-03 12:54:44 46 4
gpt4 key购买 nike

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

./src/components/App/App.js
Attempted import error: 'combineReducers'
is not exported from '../../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 的方式有什么不正确?

最佳答案

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

应该是

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

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

对两者之间的差异进行了很好的分割here .

关于reactjs - 在React应用程序中接收 "Attempted import error:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53328408/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com