gpt4 book ai didi

reactjs - React Navigation 3.x 需要循环警告

转载 作者:行者123 更新时间:2023-12-03 13:37:39 30 4
gpt4 key购买 nike

React 新手)

自从将 React Navigation 升级到 3.x 后,我在控制台中收到此警告

[23:12:54] Require cycle: src/navigation/DrawerNavigator.js -> src/navigation/index.js -> src/navigation/DrawerNavigator.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

有人知道这是什么意思吗?

最佳答案

@kelset给出的解释here非常清楚。

---> File A wants something from file B -> file B wants something from file C -> file C wants something from file A ---

There is a "circle" being created, and thus the warning says this maylead to uninitialized values.

在您的情况下,这意味着 DrawerNavigation 从文件中导入/需要某些内容,该文件本身就具有 DrawerNavigation 的导入/要求。这就是创建的“圈子”。

这是警告而不是错误,因此您的应用应该可以完美运行,不会出现任何问题。

关于reactjs - React Navigation 3.x 需要循环警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53577348/

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