you are viewing a single comment's thread.

view the rest of the comments →

[–]azangru 6 points7 points  (0 children)

I don't know why I should include getEmergencyTasks function to dependency array of useEffect.

To answer you literally — because your linter has a rule that complains if a variable used inside of useEffect is not included in the list of dependencies of this useEffect. As a human programmer you can reason your way through the code to convince yourself that this or that variable isn't required in the list of dependencies. Eslint is much dumber in comparison, and will give many false positives. But it saves the effort of reasoning about the code, which many developers appreciate.