gpt4 book ai didi

javascript - 警告 : Assign object to a variable before exporting as module default

转载 作者:行者123 更新时间:2023-12-04 00:53:11 39 4
gpt4 key购买 nike

我正在使用 react-redux,这是我的根 Reducer:

import Customers from "./customers/reducer";

export default {
Customers
};

但我收到此警告:在导出为模块默认值之前将对象分配给变量。我该如何处理?

最佳答案

有一些解决方案:

1- 禁用警告

import Customers from "./customers/reducer";

/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
export default {
Customers
};

2- 创建一个常量然后导出它

import Customers from "./customers/reducer";
const aName = {
Customers
};
export default aName;

阅读 this descriptions了解更多信息。

关于javascript - 警告 : Assign object to a variable before exporting as module default,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64816649/

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