reactjs - 致力于重构一个反应组件以删除导入/无循环
问题描述
更新
我一直在解决这个问题,感觉我终于找到了这个问题的根源。我去把两张 css 表分开到Header.scss HeaderProfile.scss中,警告仍然出现。
所以看起来这是导致问题的原因:
import/no-cycle
索引.jsx
import { HeaderProfile } from './HeaderProfile';
export type Props = {
home: Link,
links: Link[],
mobileOnly?: any,
profile?: Profile,
};
标头配置文件
import type { Profile } from './index';
export type Props = {
profile: Profile,
};
与 Dave 交谈后,问题似乎是我将 HeaderProfile 导入索引,然后需要将配置文件重新导入 HeaderProfile。我正在与 github repo 人员讨论后续步骤
// eslint-disable-next-line import/no-cycle
import { HeaderProfile } from './HeaderProfile';
感谢您提供的任何帮助!
链接到 github 仓库:
https://github.com/ifmeorg/ifme/blob/master/client/app/components/Header
解决方案
上面已更新,但出于存档目的而关闭它。有一个循环导入发生,但不像回购中的人所想的那样。在接下来的步骤中与 github repo 人员交谈。问题是他们将 HeaderProfile 导入 index.jsx,然后将 Profile 导入 HeaderProfile
推荐阅读
- powershell - 使用 Powershell 解析顺序日志文件
- html - 在“编辑”按钮上单击我在 Angular 6 应用程序中获得 DOB 字段的重复文本框
- api - Xero OAuth2.0 刷新令牌中的无效授权问题
- amazon-web-services - 将 Amazon S3 用作受限数据库
- functional-programming - FP 中引用透明的好处
- dart - 定义一个具有参数化类型的泛型类,该类期望在 dart 中实现多个抽象类
- javascript - 如何将无线电元素注入面板?
- machine-learning - 我必须使用 svc 将用户语句分为 30 个类别..那么应该怎么做
- android - 对话框内的 RecyclerView 与对话框的其他内容重叠
- sql - 在 Rails 中根据条件获取关联对象计数