Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Navigation 3.x Require cycle warning

New to React)

Since upgrade to React Navigation to 3.x i've got this warning in a console

[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.

is it anybody know what does it mean?

like image 627
dimonD Avatar asked Dec 02 '18 04:12

dimonD


Video Answer


1 Answers

The explanation given by @kelset here is pretty clear.

---> 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 may lead to uninitialized values.

In your case, this mean that DrawerNavigation import/require something from a file that have itself an import/require for DrawerNavigation. This is the "circle" created.

It's a warning and not an error, so your app should run perfectly without problems.

like image 178
perotta Avatar answered Oct 25 '22 04:10

perotta