简体   繁体   English

如何在React Native中处理依赖周期

[英]How to handle dependency cycle in React Native

I have two files which import directly from each other like this and it consists of a dependency error. 我有两个这样直接从彼此导入的文件,它包含一个依赖项错误。

Saga 佐贺

import { action } from './Action';

Action 行动

import { saga } from './Saga';

I tried adding a new root file and importing functions from that but didn't work either 我尝试添加一个新的根文件并从中导入功能,但也没有用

Root file 根文件

export * from './sagas/saga';
export * from './actions/action';

File 1 文件1

import { action } from './root file';

File 2 文件2

import { saga } from './root file';

How can this be solved? 如何解决呢?

You can try to put the needed function in another file or in the root file then import them from there. 您可以尝试将所需的函数放在另一个文件或根文件中,然后从那里导入它们。 Normally if the functions are link the should be group togheter. 通常,如果功能是链接的,则应分组使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM